[Gambas-user] Randomize

Leonardo Miliani leonardo at ...1237...
Thu Jul 13 10:39:07 CEST 2006


Benoit Minisini ha scritto:
> On Tuesday 11 July 2006 22:16, Leonardo Miliani wrote:
>> Is it possible to setup the random numbers generator with a seed?
>> In other languages this is done by randomize (x) where x is the seed.
>> Using this command, you are sure that the generator provides the same
>> numbers every time it is set up with the same seed.
>> This is useful for example in cryptography, where you can add more
>> security to a public key using a seed to interpolate the public key bits
>> with random numbers to obtain any time differents encryptions of same
>> datas and same keys.
> 
> If it is useful, I will add it.
> 
> Regards,
> 

In VB (but also in other old BASICs, i.e.: Commodore Basic, GWBASIC)
randomize timer is used to setup the RNG with the actual system time
(this is like the actual Gambas command Randomize, so you are sure to
have a random sequence), but if you write randomize 12, for example,
you'll get a specific random sequence that it will be always the same.


-- 
Ciao.
Leo

Visita il mio sito personale: www.leonardomiliani.com
e-mail: leonardo at ...1237...




More information about the User mailing list