random number generator between 0 - 1000 in c# [closed]

I need help in writing a program that will generate 100 random numbers between 0 and 1000. The out put needs to be displayed in a windows message box. i'm stuck as to what code I have use to get the numbers in the box and to only have 100 random numbers.

3

2 Answers

Have you tried this

Random integer between 0 and 1000(1000 not included):

Random random = new Random(); int randomNumber = random.Next(0, 1000); 

Loop it as many times you want

1

Use this:

static int RandomNumber(int min, int max) { Random random = new Random(); return random.Next(min, max); } 

This is example for you to modify and use in your application.

2

You Might Also Like