how to generate a random number between 2 numbers

  • Thread starter Thread starter rob
  • Start date Start date
rob said:
using Access, between say 100025 and 986523

This is right out of the Access help:

Before calling Rnd, use the Randomize statement without an argument to
initialize the random-number generator with a seed based on the system
timer.
To produce random integers in a given range, use this formula:

Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
Here, upperbound is the highest number in the range, and lowerbound is the
lowest number in the range.
 
AlCamp said:
Rob,
MyValue = Int((986523 * Rnd) + 100025)
hth
Al Camp

Needs a tweak. That could give him a number greater than 986523.
 
-----Original Message-----



This is right out of the Access help:

Before calling Rnd, use the Randomize statement without an argument to
initialize the random-number generator with a seed based on the system
timer.
To produce random integers in a given range, use this formula:

Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
Here, upperbound is the highest number in the range, and lowerbound is the
lowest number in the range.


.great, thanks alot~ cheers rob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top