Random Numbers in Python

This Comment will be submitted for moderation and will not be accessible to other users until it has been approved.


31 points

I want to generate random numbers in Python. How can I achieve that?

..Jake



1 point

Jake

The standard module random will implement a random number generator.

Here is how you can do it...

import random
random.random()

I hope this helps you.

Anonymous's picture
Created by Anonymous

Post Comment

  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <php>, <python>, <ruby>. Beside the tag style "<foo>" it is also possible to use "[foo]". PHP source code can also be enclosed in <?php ... ?> or <% ... %>.