Quantcast
Channel: Unity Forum
Viewing all articles
Browse latest Browse all 1466670

Random.Range within a For Loop, disaster.

$
0
0
Code (CSharp):
  1.  
  2. for (int i = 0; i < Slot.Length; i++)
  3.         {
  4.             Random.seed = i * i;
  5.             Slot[i].Quantity = Random.Range(0,100);
  6.         }
  7.  
The "random" numbers are: 33, 33, 33, 99, 33, 33, 99, 99, 33.

It's not a one time thing, each time two numbers are returned. To be fair, those two numbers are returned randomly. :)

I have read the docs, Googled the documentation and I don't think it's broken... I know I'm missing the concept here.

Viewing all articles
Browse latest Browse all 1466670

Trending Articles