Here the code for basically random numbers:
RND(1).
To get numbers between 1 and 100 with integers only, use
INT(RND(1*100)+1
Some BASIC Compilers require the use of RANDOMIZE to do this, but this is the standard way.
INT(RND(1*50) + 1
Will get you a random integer between 1 and 50.
To set the random number in a variable,
YourRandomNumber=Int(Rnd(1*50)+1
RND is just the function to produce a random number with decimals, so I would use Rnd(1*50)+1 to get a number with decimals between 1 and 50.
Any other questions, you may e-mail me.How do I write a program in BASIC to make random numbers and display them?
intNumber = Int(Rnd * 10) + 1
intNumber = a variable or what ever you want
10 = the number of # to choose fromHow do I write a program in BASIC to make random numbers and display them?
Basic is really not used anymore, you use VBS - goto this site, there are programs like what your asking for - it's using Visual Basic Scripts (like Basic), Gw Basic was replaced with VBS sometime back
http://www.microsoft.com/technet/scriptc鈥?/a>
use the ran function
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment