+ 2

How to fix this random number genetator

It works in C++, but I can' t get it to work here. int[] item = new int[20]; int[] number = new int[20]; Random r = new Random(); for(int i=0; i<20; i++) { item[i] = i; } for(int x=20; ×>0; x--) { r.Next(0, x); number[x-1] = item[r]; while( r < x ) /* this is moving numbers from higher array to lower */ { item[r] = item[r+1]; r++; } }

25th Nov 2016, 4:17 PM
Tomislav Markovica
Tomislav Markovica - avatar
4 Answers
+ 1
Thank you a lot. (hvala)
25th Nov 2016, 6:16 PM
Tomislav Markovica
Tomislav Markovica - avatar
0
good luck
27th Jan 2017, 4:17 PM
Idan Moral
Idan Moral - avatar