Unity Ninja Unity 3D Forum
To have exclusive access to all downloads, recourses and links within this forum, a free registered account is required. Just a heads up Wink
Share
Go down
Member [Lv. 1]
Member [Lv. 1]
Posts : 4
Points : 688
Rep : 0
Join date : 2016-10-08
View user profile

Need help with perncentage

on Sat Oct 08, 2016 5:10 pm
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.
avatar
{SUPER MEMBER}-LV.4
{SUPER MEMBER}-LV.4
Posts : 55
Points : 1558
Rep : 11
Join date : 2015-01-18
Age : 41
Location : Italia
View user profile

Re: Need help with perncentage

on Sun Oct 09, 2016 5:29 am
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);
    }
}
Member [Lv. 1]
Member [Lv. 1]
Posts : 4
Points : 688
Rep : 0
Join date : 2016-10-08
View user profile

Re: Need help with perncentage

on Sun Oct 09, 2016 6:24 am
Thank you very much Smile, but is that working for the field of the wheel of fortune how i decribed it?
Back to top
Permissions in this forum:
You cannot reply to topics in this forum