dimanche 8 mai 2016

Unity3D C# Random Int Generator

I have used C++ for a long time. Now, I just started working with C# in Unity3D. I'm almost complete at finishing an app but I can't seem to find a working int generator in Unity C# (With Min and Max values). I've tried the following:

r = Random.Range(min, max)

and

Random rand = new Random();
r = rand.next(min, max)

Both didn't work. I know in C++ you use:

r = rand() % max + min;

If you want a random number. But what is the case with Unity C#?




Aucun commentaire:

Enregistrer un commentaire