Generating random numbers

V

Visually Seen #

Hi everybody,

A friend of mine and I want to develop a program that randomly
generates times tables for young kiddos.
So how do you generate random numbers (in C#)?

Seen Sharp
 
G

Guest

Hi,

have you got Visual Studio .Net? If so.. Help->Index->Random.

Otherwise, use class Random.
 
J

Jon Skeet

A friend of mine and I want to develop a program that randomly
generates times tables for young kiddos.
So how do you generate random numbers (in C#)?

Use the System.Random class. Note that you should create a single instance
and then use that repeatedly - don't create a new instance every time you
want a new random number, or you'll get the same number if you try to get a
random number several times in quick succession. (The initial seed is based
on the current time.)

Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top