Kent said:
What am I missing here. Why doesn't this produce a random string. It is
kind of random.
<%
Const ConstantLower = "bcdfghjklmnpqrstvwxyz"
Const VowelLower = "aeiou"
Const Numbers = "0123456789"
Const NumOfChar = 12
Dim x : x = 0
Dim TmpVal
Dim TmpName
Dim y
y = 0
Do while y < 100
x = 1
TmpName = ""
TmpVal=""
Do while x <= NumOfChar
randomize
TmpVal = int(Rnd*3)
select case TmpVal
Case 0
randomize
TmpVal = int(Rnd*21)
if TmpVal = 0 then TmpVal = 1
TmpName = TmpName & mid
(ConstantLower,TmpVal,1)
Case 1
randomize
TmpVal = int(Rnd*5)
if TmpVal = 0 then TmpVal = 1
TmpName = TmpName & mid
(VowelLower,TmpVal,1)
Case 2
randomize
TmpVal = int(Rnd*10)
if TmpVal = 0 then TmpVal = 1
TmpName = TmpName & mid
(Numbers,TmpVal,1)
end Select
x = x + 1
loop
Response.Write TmpName & "<BR>"
y = y + 1
Loop
%>
Thanks for your help,
Kent
Hi Kent,
The rnd function only creates quasi-random numbers:
I have seen this while playing around with a random password generator I
created.
You can try this yourself:
create strings with a length of 128 or 256 or 512 ..., then you'll see
that a number of times the exact same string will be created.
Example (with my randomPW.asp using the rnd function):
Fixed length (128 chars) Passwords:
6kD6qnbw6EJS68rjbPr6S25u3f54c7UrRS0D3uU6f1V8482s3UKN3e0B8CgrPN308VD4PKp4L0dF24L10wMl6NsJKYs0iUQoO0R0PpQKrAkr4OJ7G1d6XpSC01ksl7WN
6kD6qnbw6EJS68rjbPr6S25u3f54c7UrRS0D3uU6f1V8482s3UKN3e0B8CgrPN308VD4PKp4L0dF24L10wMl6NsJKYs0iUQoO0R0PpQKrAkr4OJ7G1d6XpSC01ksl7WN
6kD6qnbw6EJS68rjbPr6S25u3f54c7UrRS0D3uU6f1V8482s3UKN3e0B8CgrPN308VD4PKp4L0dF24L10wMl6NsJKYs0iUQoO0R0PpQKrAkr4OJ7G1d6XpSC01ksl7WN
6kD6qnbw6EJS68rjbPr6S25u3f54c7UrRS0D3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ga3bl3
3WeVJQXrONETsAMfJ0N8jp4YkBt155e3R1q48kuE34GFJ5EhA2VywadwI8xN87UL223a0lrQ8205am3kAHMCB77x06AclO1r1jMS7c7i4F8iYC3UOnr403XIAuga3bl3
3WeVJQXrONETsAMfJ0N8jp4YkBt155e3R1q48kuE34GFJ5EhA2VywadwI8xN87UL223a0lrQ8205am3kAHMCB77x06AclO1r1jMS7c7i4F8iYC3UOnr403XIAuga3bl3
3WeVJQXrONETsAMfJ0N8jp4YkBt155e3R1q48kuE34GFJ5EhA2VywadwI8xN87UL223a0lrQ8205am3kAHMCB77x06AclO1r1jMS7c7i4F8iYC3UOnr403XIAuga3bl3
3WeVJQXrONETsAMfJ0N8jp4YkBt155e3R1q48kuE34GFJ5EhA2VywadwI8xN87UL223a0lrQ8205am3kAHMCB77x06AclO1r1jMS7c7i4F8iYC3UOnr403XIAuga3bl3
3WeVJQXrONETsAMfJ0N8jp4YkBt155e3R1q48kuE34GFJ5EhA2VywadwI8xN87UL223a0lrQ8205am3kAHMCB77x06AclO1r1jMS7c7i4F8iYC3UOnr403XIAuga3bl3
3WeVJQXrONETsAMfJ0N8jp4YkBt155e3R1q48kuE34GFJ5EhA2VywadwI8xN87UL223a0lrQ8205am3kAHMCB77x06AclO1r1jMS7c7i4F8iYC3UOnr403XIAuga3bl3
3WeVJQXrONETsAMfJ0N8jp4YkBt155e3R1q48kuE34GFJ5EhA2VywadwI8xN87UL223a0lrQ8205am3kAHMCB77x06AclO1r1jMS7c7i4F8iYC3UOnr403XIAuga3bl3
811Scv20MFXevtTeT4JBD1yuPI8Gff03WqKU6h44V3vBo06FatmN62860J81QDCJA8Xuwb580jmXhQhho08CY6YrlkV0go6No28yTK0OE4FC3xQQ6maybAJbXR8MhTj1
811Scv20MFXevtTeT4JBD1yuPI8Gff03WqKU6h44V3vBo06FatmN62860J81QDCJA8Xuwb580jmXhQhho08CY6YrlkV0go6No28yTK0OE4FC3xQQ6maybAJbXR8MhTj1
But as I will never create 128 character passwords (the users can't even
remember 8 chars), this issue is very minor to me.
Just my 2 cents
Gottfried