Help with random() macro function

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Help with random() macro function

AAM71
Dear All,

Can you explain how exactly random("seed",seed) function works? Do I need to use it to generate seed before each random() instance? Or just once? Or it substitutes random() itself? I have tried to find info but still do not get it.
As I understood "seed" is used to make random function less pseudo-random. So, if I get time stamp as a seed then "pseudo" part is allegedly decreased. But practical application (especially using loops or user functions) is not explained well on ImageJ web-site.

Thank you in advance!

Sincerely,
Alex

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Help with random() macro function

Herbie
Good day Alex,

if you run this little macro several times you may perhaps better
understand what's going on...

print(random);
random("seed", 1);
print(random);

In any case we are dealing with pseudo random number that have a flat
probability function. The seed defines the initialization of the random
generator. As seed you may use e.g. the time.

"then "pseudo" part is allegedly decreased"

Not really, because the generator is a deterministic "machine".

HTH

Herbie

:::::::::::::::::::::::::::::::::::::::::::::::
Am 04.11.18 um 19:30 schrieb Aleksandr Mironov:

> Dear All,
>
> Can you explain how exactly random("seed",seed) function works? Do I need to use it to generate seed before each random() instance? Or just once? Or it substitutes random() itself? I have tried to find info but still do not get it.
> As I understood "seed" is used to make random function less pseudo-random. So, if I get time stamp as a seed then "pseudo" part is allegedly decreased. But practical application (especially using loops or user functions) is not explained well on ImageJ web-site.
>
> Thank you in advance!
>
> Sincerely,
> Alex
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html