C# random number question

  • Автор темы Автор темы Drew
  • Дата начала Дата начала

Drew

Client
Регистрация
29.07.2012
Сообщения
70
Реакции
14
Баллы
8
Anyone have a simple way to get random number between a range in c#.

GetRandomeNumber Class is not working.
 
I use this way

public static int GetRandomNumber(int min, int max)
{
return min + BitConverter.ToInt32(Guid.NewGuid().ToByteArray(),4) % (max-min+1);
}
 
But there is one issue for rnd.Next. If you want to generate for example 10000 random numbers in one loop then you'll get the similar number or similar groups of numbers.
 

Кто просматривает тему: (Всего: 0, Пользователи: 0, Гости: 0)