Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Random Record Selection Problems.
Message
From
15/12/2003 17:34:15
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00859259
Message ID:
00859348
Views:
16
> Dang, I missed that last row. If you hear a loud bang, it's just me stepping out to the barn to
> do the decent thing!

I am sure Ms. Zuleiman (who always tends to sort last by virtue of her name) will heartily agree if she finds out that your SELECT nixed her chance of receiving a nice brochure with an even nicer coupon for something or other. ;-)

> Actually there is a good chance the code above will not select any records at all - since what
> are the chances of a particular rows RecNo() being equal to a random number - where the random
> number happens to be in the range 0 to RecCount()-1 (it's a rhetorical question).

Rhetorical answer: 1 / RECCOUNT() for any record but the last (where the probability is 0). *g*

> Also, why have you not critiqued the rest of my post?

Sorry, I did not want to come across as a criticaster; it was just that I perceived two problems with your SQL UPDATE which otherwise appeared quite intriguing in its simplicity and elegance. In particular I liked your approach of adding a function that terminates the 'search' for candidates as soon as sufficiently many records have been chosen, and in a procedurally defined command like REPLACE it would have worked perfectly. The 'classic', iterative example that you gave was basically okay (except for one minor issue) but, more importantly, it did not try to promote black magic where white would do. ;-)
Previous
Reply
Map
View

Click here to load this message in the networking platform