random numbers help needed

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sparky AKA_Sparkticus

    #1

    random numbers help needed



    Hi I am trying to create two random numbers

    LBlnum1.Caption = Int(12 * Rnd) + 1
    Lblnum2.Caption = Int(12 * Rnd) + 1

    This creates the numbers but they are always the same numbers.
    example I get 9 & 7 then 7 & 4 then 10 & 1

    is their a way to make these numbers more random ?


    Sparky


  • Rick Rothstein

    #2
    Re: random numbers help needed

    > Hi I am trying to create two random numbers[color=blue]
    >
    > LBlnum1.Caption = Int(12 * Rnd) + 1
    > Lblnum2.Caption = Int(12 * Rnd) + 1
    >
    > This creates the numbers but they are always the same numbers.
    > example I get 9 & 7 then 7 & 4 then 10 & 1
    >
    > is their a way to make these numbers more random ?[/color]

    Execute the Randomize statement (only one time) somewhere inside your
    program before using the Rnd function. The best place to execute the
    Randomize function is in the Form_Load event (or Sub Main if you start
    your programs that way).

    Rick - MVP

    Comment

    • Sparky AKA_Sparkticus

      #3
      Re: random numbers help needed

      Rick Rothstein wrote:[color=blue][color=green]
      >> Hi I am trying to create two random numbers
      >>
      >> LBlnum1.Caption = Int(12 * Rnd) + 1
      >> Lblnum2.Caption = Int(12 * Rnd) + 1
      >>
      >> This creates the numbers but they are always the same numbers.
      >> example I get 9 & 7 then 7 & 4 then 10 & 1
      >>
      >> is their a way to make these numbers more random ?[/color]
      >
      > Execute the Randomize statement (only one time) somewhere inside your
      > program before using the Rnd function. The best place to execute the
      > Randomize function is in the Form_Load event (or Sub Main if you start
      > your programs that way).
      >
      > Rick - MVP[/color]

      Cheers worked great.....

      Sparky


      Comment

      Working...