[Tutor] Random Numbers
Hugo González Monteverde
hugonz-lists at h-lab.net
Sun Nov 20 23:37:15 CET 2005
Hi,
Take a look at the random module, function randint:
>>> import random
>>> random.randint(1, 10)
7
>>> random.randint(1, 10)
9
>>> random.randint(1, 10)
1
>>> random.randint(1, 10)
8
>>> random.randint(1, 10)
7
>>> random.randint(1, 10)
9
>>> random.randint(1, 10)
1
>>> random.randint(1, 10)
1
>>> random.randint(1, 10)
7
>>> random.randint(1, 10)
2
>>> random.randint(1, 10)
9
>>>
Hugo
Merrie wrote:
> Ok first thing I need a direction on is random number generation, I
> looked through the Python manual and I must be missing it.
>
> What Im looking for, needing is a random generation 1 through 10 +
> modifier, example
> like rolling a 1d10 +1
>
> Not sure what syntex to use.
>
> Thanks!
> Merrie
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
More information about the Tutor
mailing list