Try srand:

http://docs.julialang.org/en/release-0.2/stdlib/base/#random-numbers


On Thu, Apr 17, 2014 at 6:45 AM, X Du <[email protected]> wrote:

>
>  Hi All,
>
>  Is there some comments to save or load a particular state when generating
> rand numbers?
> e.g. the code in Matlab:
>
> stream = RandStream.getGlobalStream;
> savedState = stream.State;
> u1 = rand(1,5)
> u1 =
>     0.8147    0.9058    0.1270    0.9134    0.6324
>
> stream.State = savedState;
> u2 = rand(1,5)
> u2 =
>     0.8147    0.9058    0.1270    0.9134    0.6324
>
> which can produce exactly the same random numbers.
>
>
> Thanks!
>
> Isaac
>
>
>
>

Reply via email to