Re: Random Integers
[Prev][Next][Index][Thread]
Re: Random Integers
In article <Pine.HPP.3.95.970904220239.3721B-100000@barney.gonzaga.edu>,
Hermann Chong <hchong@gonzaga.edu> wrote:
> I am writing a program, and I added a random integer in it. It stayed at
> one number, and I couldn't get it to be erratic. How can I add that in?
You need a random function in there, for example:
rand *10
To make it an integer, we need to adjust it a little to......
round(rand*10,0)
This will give you a random integer from 1 to 10.
IF you want the random number range a bit higher, then just replace the 10
with like 100 or something higher.
Hope that helps.
-Justin Smith
______________________________________________
Justin Smith j z s @ e u r o p a . c o m
______________________________________________
Follow-Ups:
References: