Hi,
Is there a way to randomly picking records from a table. I’ve tried using RND() but it seems the random sequence is repeated everytime the program is executed.
I need something that is truly “random”. Thanks.
chl88
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » Random Numbers (VB6)
Look at the help for Randomize
StuartR
Randomize Statement
Initializes the random-number generator.
Syntax
Randomize [number]
The optional number argument is a Variant or any valid numeric expression.
Remarks
Randomize uses number to initialize the Rnd function’s random-number generator, giving it a new seed value. If you omit number, the value returned by the system timer is used as the new seed value.
If Randomize is not used, the Rnd function (with no arguments) uses the same number as a seed the first time it is called, and thereafter uses the last generated number as a seed value.
Note To repeat sequences of random numbers, call Rnd with a negative argument immediately before using Randomize with a numeric argument. Using Randomize with the same value for number does not repeat the previous sequence.
Look at the help for Randomize
StuartR
Randomize Statement
Initializes the random-number generator.
Syntax
Randomize [number]
The optional number argument is a Variant or any valid numeric expression.
Remarks
Randomize uses number to initialize the Rnd function’s random-number generator, giving it a new seed value. If you omit number, the value returned by the system timer is used as the new seed value.
If Randomize is not used, the Rnd function (with no arguments) uses the same number as a seed the first time it is called, and thereafter uses the last generated number as a seed value.
Note To repeat sequences of random numbers, call Rnd with a negative argument immediately before using Randomize with a numeric argument. Using Randomize with the same value for number does not repeat the previous sequence.
I don’t suppose you have a little budget to play with? I do a little bit of legal work with a company that has a circuit board designed to generate truly random distributions (see product information for Random Master). Never tried it myself.
Who has verified that the numbers are truly random?
The random number generators provided with most products do not really generate true random sequences.
If the properties of the random number generated by VB are acceptable for your app, then you can include Randomize and select a different seed each time the program runs.
If you want a better random number generator, ask the folkes in the, e.g., newsgroups comp.programming and sci.math.num-analysys.
Who has verified that the numbers are truly random?
The random number generators provided with most products do not really generate true random sequences.
If the properties of the random number generated by VB are acceptable for your app, then you can include Randomize and select a different seed each time the program runs.
If you want a better random number generator, ask the folkes in the, e.g., newsgroups comp.programming and sci.math.num-analysys.
I don’t suppose you have a little budget to play with? I do a little bit of legal work with a company that has a circuit board designed to generate truly random distributions (see product information for Random Master). Never tried it myself.
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.
Notifications