[SciPy-user] Ideas about matrices

Alan Isaac aisaac at american.edu
Tue Nov 7 08:06:41 CST 2006


On Tue, 7 Nov 2006, Marco wrote: 
> i want a matrix with random ones or zeros: 

>>> import numpy
>>> from numpy import random
>>> x=random.random((10,10))
>>> y=x<0.5

(Or change the dtype if you prefer.)

Cheers,
Alan Isaac






More information about the SciPy-user mailing list