Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting the same (random) num 1

Status
Not open for further replies.

fergman

Technical User
Oct 19, 2000
91
US
dim Rndnum0

Randomize(10000)
Rndnum0 = Int((10000 - 1 + 1) * Rnd + 1)
Response.write(Rndnum0)


it keeps giving me 2048 how can I make it give me some real random nums.
 
Try this

DIM rand
Randomize
rand = CInt(10000 * RND + 1)

I'm guessing you're missing a C in that Int provide tools to let people become their best.
 
Actually, because you use the same seed every time - 10000 (and the correct syntax is:

Randomize 10000

), you get the same sequence of numbers. Using the example onpt gave, with no number following Randomize, it uses the system timer, which will give you a much better random sequence.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top