Fernando Perez wrote:
> On 11/1/06, David Cournapeau <[EMAIL PROTECTED]> wrote:
>   
>> Hi,
>>
>>     I want to generate some random integers,let's say in the range [-
>> 2^15, 2^16]. Why doing:
>>
>>     noise = numpy.random.random_integers(- (2 ** 15), (2 * 15), 22050)
>>
>>     gives only negative numbers ?
>>     
>
> In [3]: noise = numpy.random.random_integers(- (2 ** 15), (2 * 15), 22050)
>
> In [4]: noise[noise>0].shape
> Out[4]: (17,)
>
> In [5]: noise[noise<0].shape
> Out[5]: (22033,)
>
> In [6]: noise = numpy.random.random_integers(-(2**15), (2 ** 15), 22050)
>
> In [7]: noise[noise>0].shape
> Out[7]: (11006,)
>
> In [8]: noise[noise>0].shape
> Out[8]: (11006,)
>
> In [9]: 17./22033
> Out[9]: 0.00077156991785049694
>
> In [10]: 2.0*15/2**15
> Out[10]: 0.00091552734375
>
> close enough ;)
>   
Ok, I deserve my email to be called the most stupid email of the week... 
Sorry for the noise,

David

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion

Reply via email to