Whrandom
Stephen Hansen
news at myNOSPAM.org
Mon May 14 15:11:01 EDT 2001
You'll need to call whrandom.randint five times. Some of the
possibilities are:
nums = []
for i in range(0, 5):
nums.append(whrandom.randint(1, 1000))
or
nums = [whrandom.randint(1, 1000) for i in range(1, 1000)]
The latter bit is a list comprehension, so will only work in 2.0+. (I
believe.. then again, I never paid any attention to what was available in
1.6 since 2.0beta came out the same day. *grin*)
--S
"Oskar Stefan" <st.oskar at vol.at> wrote in message
news:9dp9md$bc0$1 at newsreaderg1.core.theplanet.net...
> Hello!
>
> Could anyone give me an Example how can
> I create 5 Random numbers between 1 and 1000.
> I know this goes with whrandom but I
> become only one number when I write whrandom.randint(1,1000)
> but I will have 5 numbers between 1 and 1000 but no number
> several times.
>
> thanks for your help
>
> osi
More information about the Python-list
mailing list