[Tutor] random number generation

Pedro Diaz Jimenez pdiaz88@terra.es
Fri, 25 May 2001 13:52:21 +0000


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

What about using the random module?. Its rather good if your aren't going
to use it in crypto

pdiaz@duero:~$ python
Python 1.5.2 (#0, Dec 27 2000, 13:59:38)  [GCC 2.95.2 20000220 (Debian 
GNU/Linux)] on linux2
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import random
>>> random.random()
0.431786822224
>>> a=[1,2,3,4,5,6]
>>> random.choice(a)
4
>>> random.choice(a)
2
>>> random.choice(a)
1
>>>


On Friday 25 May 2001 01:16, Rod Krause wrote:
> I am wondering what the syntax is for generating random numbers in python -
> I am developing a set of numeracy programs for high school kids and need to
> be able to generate questions that are different each time
>
>
> Rod Krause

- ----------------------------------------
Content-Type: text/html; charset="iso-8859-1"; name="Attachment: 1"
Content-Transfer-Encoding: quoted-printable
Content-Description: 
- ----------------------------------------

- -- 

/*
 * Pedro Diaz Jimenez
 * pdiaz88@terra.es 
 * pdiaz@acm.asoc.fi.upm.es
 *
 * Wanna see how 100000! looks like?:
 * http://acm.asoc.fi.upm.es/~pdiaz/fact_100.000
 * 
 * La sabiduria me persigue, pero yo soy mas rapido
 *
 */

Random quote:
- -------------

You know something, folks, as ridiculous as this sounds, I would rather
feel the sweet breath of my beautiful wife on the back of my neck as I
sleep than stuff dollar bills into some stranger's G-string.

		-- Homer Simpson
		   Homer's Night Out
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE7DmOVnu53feEYxlERAmvhAJsGiZbWKh4b14LaomB8PZqTxU7H3wCfRXtR
L0zcO+PEqmacdhXrxlNaHvU=
=d7bK
-----END PGP SIGNATURE-----