Information générale
Catégorie:
Codage, syntaxe et commandes
Thanks.
John
>>OK, I feel like I'm looking at a repeating # problem on an IQ test. I understand the concept, but why multiply by 25 if rand() is even or by 9 if not?
>>
>
>Ok.. ASCII a to z is chr(97) to chr(122) and since rand() returns a number between 0 and 1, then rand()* 25 will be a number between 0 and 25. 97+25 = 122. So when lnCnt is 1 or for all random even times, it will create a random letter in the range of a to z. Else it will do it in the range of chr(48) to chr(57) which is 0 to 9.
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement