0

How to generate negative random integers in C#

Is there a way to generate any random number from -2,147,483,648 to 2,147,483,647?

4th Sep 2021, 7:50 PM
Tim
Tim - avatar
2 ответов
0
Random r= new Random(<Startint>,<Endint>); r.Next(); Where Startint - number, which less Endint. For example:new Random(-20, 50)
4th Sep 2021, 9:41 PM
GDSHNIK
GDSHNIK - avatar
0
GDSHNIK Pretty sure the Random constructor accepts either empty or a specified seed value, while Next() always returns a non-negative integer
5th Sep 2021, 5:32 AM
Tim
Tim - avatar