Re: [Numpy-discussion] weighted random integers

2010-09-10 Thread Charles R Harris
On Fri, Sep 10, 2010 at 6:32 PM, wrote: > On Fri, Sep 10, 2010 at 8:28 PM, Charles R Harris > wrote: > > > > > > On Fri, Sep 10, 2010 at 6:15 PM, Charles R Harris > > wrote: > >> > >> > >> On Fri, Sep 10, 2010 at 5:46 PM, wrote: > >>> > >>> I saw some questions on the web how to create non-uni

Re: [Numpy-discussion] weighted random integers

2010-09-10 Thread josef . pktd
On Fri, Sep 10, 2010 at 8:28 PM, Charles R Harris wrote: > > > On Fri, Sep 10, 2010 at 6:15 PM, Charles R Harris > wrote: >> >> >> On Fri, Sep 10, 2010 at 5:46 PM, wrote: >>> >>> I saw some questions on the web how to create non-uniform random >>> integers in python. >>> >>> I don't know what th

Re: [Numpy-discussion] weighted random integers

2010-09-10 Thread Charles R Harris
On Fri, Sep 10, 2010 at 6:15 PM, Charles R Harris wrote: > > > On Fri, Sep 10, 2010 at 5:46 PM, wrote: > >> I saw some questions on the web how to create non-uniform random >> integers in python. >> >> I don't know what the best way is but here is another way that looks >> reasonably fast >> >>

Re: [Numpy-discussion] weighted random integers

2010-09-10 Thread Charles R Harris
On Fri, Sep 10, 2010 at 5:46 PM, wrote: > I saw some questions on the web how to create non-uniform random > integers in python. > > I don't know what the best way is but here is another way that looks > reasonably fast > > >>> rvs = np.dot(np.random.multinomial(1, [0.1, 0.2, 0.5, 0.2], > size=10

[Numpy-discussion] weighted random integers

2010-09-10 Thread josef . pktd
I saw some questions on the web how to create non-uniform random integers in python. I don't know what the best way is but here is another way that looks reasonably fast >>> rvs = np.dot(np.random.multinomial(1, [0.1, 0.2, 0.5, 0.2], >>> size=100),np.arange(4)) >>> np.bincount(rvs)/100.