randomize

1. Member
Join Date
Dec 1969
Posts
48

## randomize

This code give me a nice random number<BR> Int(Rnd * 6) + 1<BR>However, i only get one digit. I am trying to create code to give me a 6 digit password (numbers only) I have tried this<BR> Int(Rnd *100000) + 1<BR>But it not only gives me 6 digits but 5 and 4 and so forth, what am i missing to specify just 6 digits.<BR>

2. Sathiya Guest

## RE: randomize

Int(Rnd *100001 + 1000000)<BR>Try this and see<BR>

3. Senior Member
Join Date
Dec 1969
Posts
1,671

## RE: randomize

Oops, one too many digits. Try: Int((Rnd * 90000) + 100000)

4. Member
Join Date
Dec 1969
Posts
48

## RE: randomize

that almost works, it does give 6 numbers, but the numbrs all start with the #1, i did this to fix<BR> Int((Rnd * 90000) + 100000) * 3<BR>That seemed to work to a point, i get different starting numbers, but there must be an easier way?? Any ideas??<BR> <BR>

5. John Weeflaar Guest

## RE: randomize

This should work:<BR>100000 + Int(Rnd*900000)<BR>Notice that it is nine hundred thousand.That gives maximum number of possibilities of random numbers between 100000 to 999999.<BR><BR>Cheers

#### Posting Permissions

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