[Numpy-discussion] possible bug in seed argument

Travis Oliphant oliphant.travis at ieee.org
Fri Jul 28 11:42:40 CDT 2006


Gary Ruben wrote:
> See below:
>
> Robert Kern wrote:
>   
>> Gary Ruben wrote:
>>     
>>> Should
>>>  >>> seed(1)
>>> act the same as
>>>  >>> seed(array([1]))
>>> in the random module?
>>>       
>> No. They use slightly different mechanisms to seed. The integer uses RandomKit's 
>> seeding routine. I borrowed Python's mechanism for seeding from an array of 
>> integers. Now that it comes up, though, it is probably a good idea to use the 
>> same mechanism for both cases.
>>
>>     
>>> It generates a traceback with the Windows 1.0b1 binary.
>>>       
>> Please always copy-and-paste tracebacks when reporting bugs. It works for me 
>> with r2881; I'll rebuild with a later version and try again.
>>     
>
> Thanks Robert,
> Here it is for reference. Not a very deep traceback:
>   

It looks like this is a Python 2.3 error.  In Python 2.4, the 
PyLong_AsUnsignedLong was changed to accept Python  integers as well as 
Python longs. 

The problem with fixing it is I'm not sure where PyLong_AsUnsignedLong 
is being called.  I can't find that call in the current source code.  
It's possible that Pyrex changed and this function is no longer being 
used in mtrand.c

-Travis






More information about the Numpy-discussion mailing list