[Scilab-users] {EXT} Can you suggest a more efficient procedure for generating random variables?
Heinz Nabielek
heinznabielek at me.com
Mon Mar 18 11:06:43 CET 2019
Ingenious. Works with precision. Gigantically fast for a million random deviates. Ideal for Monte-Carlo simulations.
I had never heard of dsearch* before......
Thanks a lot
Heinz
* I wished the Scilab help files would be more readable.....
> On 18.03.2019, at 09:50, Dang Ngoc Chan, Christophe <Christophe.Dang at sidel.com> wrote:
>
> Hello Heinz,
>
>> De : Heinz Nabielek
>> Envoyé : dimanche 17 mars 2019 23:50
>>
>> I need to generate random deviates x according to a given cumulative
>> distribution y that is available only in tabular form.
>> [...]
>> for i=1:N;
>> x=[x find(y>z(i),1)];
>> end;
>>
>> y is a previously defined table with values monotonically increasing from zero
>
> I guess these are quantiles.
>
> I think you can vectorise with something like
>
> x = dsearch(z, y)
>
> I tried a little bit and it seems to work but I don't know the exact application so...
>
> HTH
>
> --
> Christophe Dang Ngoc Chan
> Mechanical calculation engineer
>
> Public
> This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error), please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
More information about the users
mailing list