How do make a function that creates a sequence of n random numbers?

Paul Rubin http
Tue Feb 17 21:01:29 CET 2004

shivermetimbers15 at (shivermetimbers15) writes:
> I'm new to Python, as you can tell, and I'm interested in how to do this.

What other languages do you use and what do you want the random
numbers for?  That might be of some help in understanding what level
to answer your question at.

The simplest answer is something like

   import random    # load python's random number module
   seq = [random.random() for i in xrange(n)]  # generate sequence of length n

but that may not be what you want.

More information about the Python-list mailing list