Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Computer Drawing
Message
De
14/04/2003 20:35:26
Gerry Schmitz
GHS Automation Inc.
Calgary, Alberta, Canada
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00777497
Message ID:
00777513
Vues:
11
If your objective is to pick one record out of N records, since each record has a "record number", you could do the following:

RAND( -1 )
GO INT( RECCOUNT() * RAND() )

? "The winner is: " + ...table field...


I did something similar in a "video poker" game I wrote, where the record count was 52.

It seemed random enough because, in the end, I always lost ...

>I want to do an automatic computer drawing for certain people, I puted all the records in a cursor including how many times they have a chance to win, each chance is a seperate reocrd, what is the best method that it should pick random records ?, I worked with RAND(), I added a numeric field named no then I did
>
>RAND(-1)
>REPLACE ALL no WITH RAND()*1000
>
>then I did select top 1 from cursor order by no
>
>Can anyone advise me if with that way is it really random so I can be sure that the drawing is fare ?
>
>Any help will be greatly apriciated.
>
>Simon
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform