[Zope] Random # generator
John Toews
john@academiccolab.org
Fri, 23 May 2003 14:23:16 -0500
Thanks,
Someone else pointed that out as well (and I found it on the python
module site too :$) but now I get a security error:
Error Type: Unauthorized
Error Value: You are not allowed to access random in this context
Even the "emergency" admin account can't seem to do it.
Thoughts?
-----Original Message-----
From: Passin, Tom [mailto:tpassin@mitretek.org]=20
Sent: Friday, May 23, 2003 2:18 PM
To: zope@zope.org
Subject: RE: [Zope] Random # generator
[ John Toews]
> I know this is a stupid question, I'm feeling quite inept as a=20
> programmer right now, but I cannot figure out how to generate a random
> number. I've tried a few different methods but can't seem to get any=20
> good result.
>=20
> Code (Python script):
>=20
> import random
> g =3D random.Random()
> return g
>=20
>=20
Gotta check the manual - it's
random.random()
Also, you can just write this if you like (no need for the intermediate
variable) -
import random
return random.random()
Works fine for me!
Cheers,
Tom P
_______________________________________________
Zope maillist - Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -=20
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )