[Tutor] list noise [not what you think]

dman dsh8290@rit.edu
Thu, 7 Feb 2002 22:22:49 -0500


On Fri, Feb 08, 2002 at 11:33:12AM +0900, kevin parks wrote:
| Hi all,
| 
| Is there a way to fill a list with random values? I'd like to
| make a list and fill it with either white noise, pink noise, or
| brownian values, and then later (hopefully) filter and quantize
| them. Does Python have these different kinds of noise generators
| built in or as part of some standard module?
| 
| Can anyone help me get started or point me to the right (or a right)
| approach?

How about :

import random

# do it this way so you aren't increasing the size later
l = [ None ] * <how big do you want it?>
for i in xrange( len( l ) ) :
    l[i] = random.random()

?

-D

-- 

Microsoft is to operating systems & security ....
                                     .... what McDonald's is to gourmet cooking