[Gambas-user] UnRandom (?) Rnd - 1.0.14

Frank Berg frankberg at ...390...
Sat Apr 15 02:16:57 CEST 2006


Hi,
i was correct the code
frank

ps
the Randomize() will init the rnd procedre.. and then the rnd() get the next 
random number.
to use every time Randomize(), is starting every time a new random sequence.
you can see in you code, the output you receive is not a realy random.
> . . .
> PUBLIC SUB Form_Open()
>
>   DIM iLap AS Integer
>   DIM i1 AS Integer
>   DIM i2 AS Integer
>   DIM i3 AS Integer
>   DIM i4 AS Integer
>   DIM i5 AS Integer
>

Randomize()   ' insert here

>   DO UNTIL iLap = 100000000 ' one hundred million
******>     Randomize() ' is here to delete
>     SELECT CASE Int(Rnd(1, 5))
>       CASE 1
>         i1 = i1 + 1
>       CASE 2
>         i2 = i2 + 1
>       CASE 3
>         i3 = i3 + 1
>       CASE 4
>         i4 = i4 + 1
>       CASE 5
>         i5 = i5 + 1
>     END SELECT
>     iLap = iLap + 1
>   LOOP
>
>   PRINT i1, i2, i3, i4, i5
>
> End
> . . .
>
> Paul
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting 
> language
> that extends applications into web and mobile media. Attend the live 
> webcast
> and join the prime developer group breaking into this new coding 
> territory!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
> 






More information about the User mailing list