• Random Numbers (VB6)

    Author
    Topic
    #403059

    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

    Viewing 3 reply threads
    Author
    Replies
    • #807394

      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.

    • #807395

      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.

    • #807396

      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.

      • #807817

        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.

        • #807866

          > Who has verified that the numbers are truly random?

          That’s a trick question: it’s not possible to verify true randomness. clever

          • #807872

            It is possible to analyze the distribution and its properties against the criteria specified in books such as Knuth’s.

            There are ongoing discussions of such issues in comp.programming and sci.math.num-analysis.

          • #807873

            It is possible to analyze the distribution and its properties against the criteria specified in books such as Knuth’s.

            There are ongoing discussions of such issues in comp.programming and sci.math.num-analysis.

        • #807867

          > Who has verified that the numbers are truly random?

          That’s a trick question: it’s not possible to verify true randomness. clever

      • #807818

        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.

    • #807397

      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.

    Viewing 3 reply threads
    Reply To: Random Numbers (VB6)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: