Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
RAND()om my eyeballs!
Message
De
15/01/2002 16:11:09
Terrence Spencer
Municipal Advisory Council of Texas
Austin, Texas, États-Unis
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
RAND()om my eyeballs!
Divers
Thread ID:
00605080
Message ID:
00605080
Vues:
41
Okay I thought I had this neat password generator setup and working fine...until I ran it again the next night and came up with the exact same "ramdom" passwords...in the exact same order as they were generated the night before. That is when I had to go to sleep.

So I have a table of 1650 records with various unique names in it, and a field for the number of times the name has been used.
Char(15), and numeric 1,0

I pick a random number with RAND(). I go to the record number of the random number. So if rand() returned 147, I go to that record. I grab the name. Then I create another random number to add onto the beginning of the name so the suggested password might be 437texas, or 1263humbolt.

In my application I am storing these passwords in a user account table, but mind you I am just testing. So I blow off 20 or 30 passwords, pleased with myself.

The next night I come in again and generate a couple of passwords and I notice they are 'exactly' the same as last night and in the same order!

Here is the code:

<snip>
sele pwnames
*I used 1.6 because I have 1620 records in my names table
lnRandomRec = (RAND() * 1000 ) * 1.6
GO lnRandomRec
DO WHILE PWNames.Cnt > 5
lnRandomRec = (RAND() * 1000 ) * 1.6
GO lnRandomRec
ENDDO

REPLACE PWNames.Cnt WITH PWNames.Cnt + 1
lcPassNumb = TRANSFORM((RAND() *1000),"999")
lcPassName = TRIM(PWNames.Name)
lcPassWord = lcPassNumb + lcPassName
<snip>

I am sure there is a good explaination for this, or I am slipping over the edge.

Terrence
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform