0

I making a program. I know most of it just need help with the number generator. I want it to occur the number of times inputted.

3
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by skatamatic
0

.Net has a class for that.

Random ran = new Random();
int i = ran.Next(10);  //This will make i an integer between 0 and 9

for (int x = 0; x < i; x++)
   //Do stuff

Hope this helps!

1

You could do.

Random randomNumGenerator = new Random();

to make it occur a lot of times

for (int i = 0; i <=15; i++)
    random = randomNumGenerator.Next(1,7)
    numOccurrance[random]++//stores it in an array
0

Who downvoted me twice over my post, then upvoted the guy that said the exact same thing right after I did despite the fact that he didn't even put curly braces around his for loop therefore causing numOccurance to only get incremented once at one index?? The humanity!

Edited by skatamatic: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.