469,578 Members | 1,699 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,578 developers. It's quick & easy.

random.random(), random not defined!?

do i need to import something to use random?
Jun 27 '08 #1
4 11215
On Sun, Apr 20, 2008 at 12:58 AM, globalrev <sk*******@yahoo.sewrote:
do i need to import something to use random?
--
you need to import random :)

Python 2.5.1 (r251:54863, Mar 7 2008, 03:39:23)
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>import random
random.random()
0.76018998919085967
Jun 27 '08 #2
globalrev wrote:
do i need to import something to use random?
No, you need to import random
Jun 27 '08 #3
On Apr 19, 3:36�pm, John Machin <sjmac...@lexicon.netwrote:
globalrev wrote:
do i need to import something to use random?

No, you need to import random
But you could alsways import it as something.
>>import random as something
something.random()
0.45811606256668347
Jun 27 '08 #4
En Sat, 19 Apr 2008 16:28:37 -0300, globalrev <sk*******@yahoo.seescribió:
do i need to import something to use random?
Let me guess: you have a script named random.py? Perhaps the same one you're executing?
In that case when you write "import random", you're importing *your* script instead of the standard one.

--
Gabriel Genellina

Jun 27 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

28 posts views Thread by Paul Rubin | last post: by
4 posts views Thread by Jesse Noller | last post: by
15 posts views Thread by John Cassidy | last post: by
10 posts views Thread by Marshall Belew | last post: by
3 posts views Thread by Darren Clark | last post: by
2 posts views Thread by KS | last post: by
3 posts views Thread by Daniel | last post: by
8 posts views Thread by Daniel | last post: by
6 posts views Thread by Mike Langworthy | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.