[SciPy-dev] Re: [Numpy-discussion] Release of scipycorebetawillhappen next week.
Charles Harris
charles.harris at sdl.usu.edu
Tue Sep 27 22:05:49 CDT 2005
OK, looks good. Thanks for doing all the work to get this into SciPY.
Chuck
-----Original Message-----
From: scipy-dev-bounces at scipy.net on behalf of Robert Kern
Sent: Tue 9/27/2005 8:42 PM
To: SciPy Developers List
Subject: Re: [SciPy-dev] Re: [Numpy-discussion] Release of scipycorebetawillhappen next week.
Charles Harris wrote:
> Robert Kern wrote:
>
>>times as you like with different states (another benefit of the
>>/dev/urandom seeding over seeding with the time; there's no real chance
>
> I like /dev/urandom, but is it portable?
Lots of UNIX-like systems have it now. I don't think any OS has a
/dev/urandom that *isn't* an uninterruptable stream of random bits.
> What is the windows equivalent?
Here's the snippet from RandomKit:
/* Windows crypto */
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0400
#endif
#include <windows.h>
#include <wincrypt.h>
#endif
...
HCRYPTPROV hCryptProv;
BOOL done;
if (!CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL,
CRYPT_VERIFYCONTEXT) || !hCryptProv)
return RK_ENODEV;
done = CryptGenRandom(hCryptProv, size, (unsigned char *)buffer);
CryptReleaseContext(hCryptProv, 0);
if (done)
return RK_NOERR;
> I've been wondering, as I run linux and /dev/urandom is always handy.
>
> I also think some provision for setting a simple seed, perhaps just a long,
> is useful for testing when it is nice to have a repeatable sequences.
Way ahead of you. :-)
def seed(self, seed=None):
"""Seed the generator.
seed(seed=None)
seed can be an integer, an array (or other sequence) of integers
of any
length, or None. If seed is None, then RandomState will try to
read data
from /dev/urandom (or the Windows analogue) if available or seed
from
the clock otherwise.
"""
--
Robert Kern
rkern at ucsd.edu
"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
_______________________________________________
Scipy-dev mailing list
Scipy-dev at scipy.net
http://www.scipy.net/mailman/listinfo/scipy-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 3901 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/scipy-dev/attachments/20050927/2e5d8680/attachment.bin
More information about the Scipy-dev
mailing list