random number not random enough

Results 1 to 2 of 2

Thread: random number not random enough

  1. #1
    yls Guest

    Default random number not random enough

    allKeys = RS.GetRows &#039 convert RS to an array!<BR><BR>recCount = UBound( allKeys, 2 ) + 1<BR><BR>choose = Int( Rnd * recCount ) + 1<BR><BR>hi, i used to above to get random records. BUT i am getting the same records all the time! please help... i add the keyword RANDOMIZE before recCount = UBound( allKeys, 2 ) + 1<BR>AND it works BUT it will go greater than the no of size records in the array..<BR>

  2. #2
    Eddie Campbell Guest

    Default RE: random number not random enough

    To get random numbers you MUST use the Randomize statement. As for the Id being greater than the number of records in the array, have you remembered that the array starts at 0. So if your table has 50 records, the array elements will be numbered 0-49. <BR><BR>I think that this will work for you<BR>Allkeys = Rs.GetRows<BR>recCount=Ubound(AllKeys,2) + 1<BR>Randomize<BR>choose = Int(Rnd * recCount)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts