Re: [Pdl-general] Generating a vector of random integers

2018-04-08 Thread Craig DeForest
Hi, Will! Answers in line. Cheers, Craig > On Apr 8, 2018, at 11:33 AM, William Schmidt > wrote: > > Craig, > > Thank you, it works but first I had to pick those method calls apart to see > what each is doing and rtfm about sever in PDL::Core. > > So, I am

Re: [Pdl-general] Generating a vector of random integers

2018-04-08 Thread Karl Glazebrook
Noting there is also the module PDL::GSL::RNG; which has a lot of stuff from GSL > On 7 Apr 2018, at 10:58 am, Craig DeForest wrote: > > Welcome, William! > > You are probably looking for “random()”, which has the same syntax as > “zeroes()” but returns a vector of

Re: [Pdl-general] Generating a vector of random integers

2018-04-08 Thread William Schmidt
Craig, Just discovered PDL::NiceSlice which explains that slicing *$vec->(...);* syntax I asked about. Will On Sun, Apr 8, 2018 at 12:33 PM, William Schmidt < t.william.schm...@gmail.com> wrote: > Craig, > > Thank you, it works but first I had to pick those method calls apart to > see what

Re: [Pdl-general] Generating a vector of random integers

2018-04-08 Thread William Schmidt
Craig, Thank you, it works but first I had to pick those method calls apart to see what each is doing and rtfm about *sever* in PDL::Core. So, I am left with a set of questions best depicted with some examples. As I understand the ::Core pod, that random call and floor are creating a virtual

Re: [Pdl-general] Generating a vector of random integers

2018-04-07 Thread Sergey Kolychev
Hi Will, I don't know solve the task via PDL, but in the past I used this http://search.cpan.org/~nwellnhof/Math-Random-Discrete-1.01/lib/Math/Random/Discrete.pm#rand to get a random weighed sample. Thanks. On Fri, Apr 6, 2018, 16:16 William Schmidt wrote: > Hello

Re: [Pdl-general] Generating a vector of random integers

2018-04-06 Thread Craig DeForest
Welcome, William! You are probably looking for “random()”, which has the same syntax as “zeroes()” but returns a vector of pseudorandom values on [0,1). To make a vector of a million of those, use “$a = random(1e6)”. To make random integers based on a histogram that you already have in-hand, a

[Pdl-general] Generating a vector of random integers

2018-04-06 Thread William Schmidt
Hello Piddlers, I am moving from R to PDL, with tons of experience with Perl, lots with R but zero with PDL, so this is a pretty basic question. I can see from the PDL Book that PDL is very sophisticated, with much more functionality than I will ever use, but I want to master basic PDL to