[Gambas-user] Random Numbers Functions info

Charles Bukowski charlesbukowski.italy at gmail.com
Mon May 9 18:06:10 CEST 2022


I would like to understand how it works with gambas for both randomness and
predictability.
Many thx for your clear explanation!
C.B.

Il giorno lun 9 mag 2022 alle ore 16:27 Benoît Minisini <g4mba5 at gmail.com>
ha scritto:

> Le 08/05/2022 à 07:08, Charles Bukowski a écrit :
> > Not for any particular reason. I am asking just to understand if
> > randomness level of numbers generated by standard gambas functions is
> > the same/comparable with the analogue rnd functions of more popular
> > programming languages (e.g. c, c++,python,java).
> >
>
> It depends on what your need.
>
> Sometimes what you need is reproducibility, and how much random are the
> pseudo-random numbers is not very important.
>
> Sometimes you need the contrary, usually for cryptographic reasons, and
> you want pseudo-random numbers as much random as possible.
>
> In gambas, you make the difference with the RANDOMIZE instruction that
> intializes the pseudo-random numbers generator.
>
> The same seed gives you the same numbers, so you achieve
> reproducibility. At startup, the seed is initialized with the time of
> the day.
>
> Otherwise, either you directly use what is provided by the OS
> ('/dev/random' or '/dev/urandom') for maximum randomness, either you use
> RANDOMIZE with the result of '/dev/(u)random' to get a random number serie.
>
> Regards,
>
> --
> Benoît Minisini
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20220509/89460dd9/attachment.htm>


More information about the User mailing list