FragMate CommunityLog in

FragMate - Software and Game Developer Community, including Resources, Forums, Marketplace & More.

Share

descriptionNeed help with perncentage

more_horiz
Hello,

I've been trying a long time to program a code which gives probabilities my Wheel of Fortune. The wheel of fortune has six fields, and each field is to get a chance in percent.

I have so far:

Number between 1-10 = 10% probability
Number between 11-40 = 30% probability
Number between 41-100 = 60% probability

[Random.Range(int min,int max)]

But i dont know how to use it.... Can someone help me?

Thanks.Kevin.

descriptionRe: Need help with perncentage

more_horiz
Hello this is a small example

Code:

using UnityEngine;
using System.Collections;

public class Random : MonoBehaviour {

 public  int R1Min =1;
 public  int R1Max = 100;
 private int number;


    void OnGUI()
    {
        if (Input.GetKeyDown(KeyCode.G))
        {
            
            number = Random.Range(R1Min, R1Max);
            Debug.Log(number);
        }

        GUI.Label(new Rect(10, 10, 220, 220), "The number that was generated: " + number);
    }
}

descriptionRe: Need help with perncentage

more_horiz
Thank you very much Smile, but is that working for the field of the wheel of fortune how i decribed it?
Permissions in this forum:
You cannot reply to topics in this forum