in unity,
If i’m using Random.Range(0,100). in a for loop to determine different alpha channels of a few pixels,
will that produce similar results for all of them or will they be random, different, each time?
in unity,
If i’m using Random.Range(0,100). in a for loop to determine different alpha channels of a few pixels,
will that produce similar results for all of them or will they be random, different, each time?
If you take a look at the Random class inside of Unity you’ll see that the only function inside is Range().
It will return a float or an int depending on which one you input.
BE AWARE THAT WHEN USING INTS, THE SECOND NUMBER IS EXCLUSIVE.
So Range(0,3) means with either 0 1 or 2.
I use Random.Range for everything random I need in Unity and it works great and is easy to use. Don’t take my word for it though plug it in and see what it does.
function Start(){
for(var i:int = 0; i < 1000; i++){
var n:int =
Random.Range(0, 10); // MEANING ZERO THROUGH NINE INCLUSIVE
Debug.Log(n);
}
}
No the seed is updated every time you call a random function.