Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Random number generation
Message
De
06/05/2003 10:04:08
 
 
À
06/05/2003 10:00:32
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00785329
Message ID:
00785359
Vues:
18
Interesting, the reason that I'm posing this question is that this program has been in place for about 8 months. A question arose when a certain person was selected for the 4th time, others having never been chosen at all. My reply is "that's because it's random!", but wanted a little feedback to reinforce my position.

Thanks, Jeff

>>I suppose that may simplify the code a little. How about the randomness of the numbers that are returned, do you believe this to be as random as it can be? The help file indicates calling RAND 1st with a -1 to achieve the most random result.
>
>That is right - if you forget this, you will get the same sequence of "random" numbers every time the executable is run.
>
>Pseudorandom numbers are based on some formula, where each number is calculate on the basis of the previous one - the sequence being fairly well distributed over the entire range (0 <= x < 1). To start the sequence, a function call like rand(-1) will determine the initial number, based on the system clock - thus assuring that the sequence will be different each time.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform