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

You are not connected. Please login or register

Unity Ninja Unity 3D Forum » General Dicussions » Need help with perncentage

Need help with perncentage

View previous topic View next topic Go down  Message [Page 1 of 1]

1 Need help with perncentage on Sat Oct 08, 2016 5:10 pm

Mopsi


Member [Lv. 1]
Member [Lv. 1]
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.

View user profile

2 Re: Need help with perncentage on Sun Oct 09, 2016 5:29 am

PitbullM


Member [Lv. 3]
Member [Lv. 3]
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);
    }
}

View user profile

3 Re: Need help with perncentage on Sun Oct 09, 2016 6:24 am

Mopsi


Member [Lv. 1]
Member [Lv. 1]
Thank you very much Smile, but is that working for the field of the wheel of fortune how i decribed it?

View user profile

View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum