|   | 1 |  initial version  | 
Sage language is Python with some additional functions and classes.
So, Sage has a random function defined, that returns a random number in the interval $[0,1]$:
sage: random()
0.2808809147593442
If you want to use the sample function from the random python module, you just have tom import it before your Python code:
sage: import random
|   | 2 |  No.2 Revision  | 
Sage language is Python with some additional functions and classes.
So, Sage has a random function defined, that returns a random number in the interval $[0,1]$:
sage: random()
0.2808809147593442
If you want to use the sample function from the random python module, you just have tom import it before your Python code:
sage: import random
If you do not want to overwrite the random Python function, you can do:
sage: from random import sample
but then use sample instead of random.sample.
|   | 3 |  No.3 Revision  | 
Sage language is Python with some additional functions and classes.
So, Sage has a random function defined, that returns a random number in the interval $[0,1]$:
sage: random()
0.2808809147593442
If you want to use the sample function from the random python module, you just have tom import it before your Python code:
sage: import random
If you do not want to overwrite the random Sage function by the random Python function, module, you can do:
sage: from random import sample
but then use sample instead of random.sample.
 Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.
 
                
                Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.