And don't trust the Debug mode! Because in Debug mode with breakpoints you will see different values each time.
* This source code was highlighted with Source Code Highlighter.
- int[] arr = new int[count];
- for (int j = 0; j < count; j++)
- {
- Random rnd = new Random();
- arr[j] = rnd.Next(int.MaxValue);
- }
Use this one! good Example below:
* This source code was highlighted with Source Code Highlighter.
- int[] arr = new int[count];
- Random rnd = new Random();
- for (int j = 0; j < count; j++)
- {
- arr[j] = rnd.Next(int.MaxValue);
- }
ваще-то уж если совсем по правильному то:
ОтветитьУдалитьnew Random(unchecked((int) (DateTime.Now.Ticks))