-2

How can I a random number from 25 to 225 by 20? For example: 25, 45 .65 ,85, 105 to 225?

2 Answers2

1
Random rnd = new Random();
....
int x = rnd.Next(11)*20 + 25; // or .Next(10), if 225 is exclusive
AlexD
  • 32,156
  • 3
  • 71
  • 65
0

Create an array of the acceptable values. i.e. 25,45,65, ... 255. Use a random generated number to access the indexes of the array. Get the value at that array index. Happiness and joy abound in the world.

jwpfox
  • 5,124
  • 11
  • 45
  • 42