Re: [Numpy-discussion] skip samples in random number generator

2014-10-02 Thread Robert Kern
On Thu, Oct 2, 2014 at 11:56 PM, Sturla Molden wrote: > Robert Kern wrote: > >> Yes, but that would require rewriting much of numpy.random to allow >> replacing the core generator. This would work out-of-box because it's >> just manipulating the state of the current core generator. > > Yes, then

Re: [Numpy-discussion] skip samples in random number generator

2014-10-02 Thread Sturla Molden
Robert Kern wrote: > Yes, but that would require rewriting much of numpy.random to allow > replacing the core generator. This would work out-of-box because it's > just manipulating the state of the current core generator. Yes, then we just need to sacrifice a year's worth of CPU time, and a PR w

Re: [Numpy-discussion] skip samples in random number generator

2014-10-02 Thread Brad Buran
Thanks for the great input. The idea of implementing jump-ahead in numpy.random would be a very nice feature, but I don't currently have the time to work on implementing such a feature. For now, it seems the simplest approach is to cache the RandomState and reuse that later. Brad On Thu, Oct 2,

Re: [Numpy-discussion] skip samples in random number generator

2014-10-02 Thread Robert Kern
On Thu, Oct 2, 2014 at 9:52 PM, Sturla Molden wrote: > Robert Kern wrote: > >> No one needs small jumps of arbitrary size. The real use case for >> jumping is to make N parallel streams that won't overlap. You pick a >> number, let's call it `jump_steps`, much larger than any single run of >> you

Re: [Numpy-discussion] skip samples in random number generator

2014-10-02 Thread Sturla Molden
Robert Kern wrote: > No one needs small jumps of arbitrary size. The real use case for > jumping is to make N parallel streams that won't overlap. You pick a > number, let's call it `jump_steps`, much larger than any single run of > your system could possibly consume (i.e. the number of core PRNG

Re: [Numpy-discussion] skip samples in random number generator

2014-10-02 Thread Robert Kern
On Thu, Oct 2, 2014 at 5:28 PM, Nathaniel Smith wrote: > On 2 Oct 2014 16:52, "Robert Kern" wrote: >> >> On Thu, Oct 2, 2014 at 4:42 PM, Brad Buran wrote: >> > Given the following: >> > >> > from numpy import random >> > rs = random.RandomState(seed=1) >> > # skip the first X billion samples >>

Re: [Numpy-discussion] skip samples in random number generator

2014-10-02 Thread Nathaniel Smith
On 2 Oct 2014 16:52, "Robert Kern" wrote: > > On Thu, Oct 2, 2014 at 4:42 PM, Brad Buran wrote: > > Given the following: > > > > from numpy import random > > rs = random.RandomState(seed=1) > > # skip the first X billion samples > > x = rs.uniform(0, 10) > > > > How do I accomplish "skip the firs

Re: [Numpy-discussion] skip samples in random number generator

2014-10-02 Thread Robert Kern
On Thu, Oct 2, 2014 at 4:42 PM, Brad Buran wrote: > Given the following: > > from numpy import random > rs = random.RandomState(seed=1) > # skip the first X billion samples > x = rs.uniform(0, 10) > > How do I accomplish "skip the first X billion samples" (e.g. 7.2 > billion)? I see that there's

[Numpy-discussion] skip samples in random number generator

2014-10-02 Thread Brad Buran
Given the following: from numpy import random rs = random.RandomState(seed=1) # skip the first X billion samples x = rs.uniform(0, 10) How do I accomplish "skip the first X billion samples" (e.g. 7.2 billion)? I see that there's a numpy.random.RandomState.set_state which accepts (among other par