Goku
Goku

Reputation: 1

How do i generate a random integer with increment being only of 100's -- C#

Random random = new Random();
int randomNumber = random.Next()

How do I set output random integers with increments being only in 100's?

Upvotes: 0

Views: 1073

Answers (1)

itsme86
itsme86

Reputation: 19496

You can take a random number from 0 through 9 (I'm assuming you want something between 100 and 900) and then multiply the result by 100.

var num = random.Next(10) * 100;

Upvotes: 4

Related Questions