[ncl-talk] Questions about random number generators

Adam Phillips asphilli at ucar.edu
Mon Dec 4 14:45:51 MST 2017


Hi Liang,
If you want different results, you will need to set random_setallseed:
http://www.ncl.ucar.edu/Document/Functions/Built-in/random_setallseed.shtml

random_setallseed is mentioned on a number of random number generator
functions but surprisingly not on the two you mentioned. See:
http://www.ncl.ucar.edu/Document/Functions/Built-in/random_uniform.shtml
for use-case examples.
Adam

On Mon, Dec 4, 2017 at 2:37 PM, Liang Chen <lchen15 at gmu.edu> wrote:

> Hi NCL Talk,
>
> Does anyone know how the “pseudo-random" numbers are generated in NCL
> random number functions (such as rand and generate_unique_indices)? It
> seems that these functions give the exactly same values every time when you
> re-run NCL…
>
> For instance, I am using NCL 6.4.0 on Yellowstone. I use
> generate_unique_indices twice to get two sets of random indices:
>
> ncl 0> print(generate_unique_indices(10))
> (0)     5
> (1)     3
> (2)     0
> (3)     1
> (4)     8
> (5)     9
> (6)     4
> (7)     2
> (8)     6
> (9)     7
> ncl 1> print(generate_unique_indices(10))
> (0)     5
> (1)     6
> (2)     8
> (3)     2
> (4)     7
> (5)     1
> (6)     3
> (7)     9
> (8)     4
> (9)     0
>
> If I exit and re-enter NCL, generate_unique_indices will give the exactly
> same two sets of indices as above.
>
> Thank you in advance!
>
> ~Liang
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>



-- 
Adam Phillips
Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
www.cgd.ucar.edu/staff/asphilli/   303-497-1726

<http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171204/11ff6074/attachment.html>


More information about the ncl-talk mailing list