ok here's something confusing the heck outta me. i'm making a random password generator of sorts, giving the user the option of numbers, lowercase letters, uppercase letters, or any combination thereof. there's more to the program than this obviously, but this is the relevant code i have set up to complete this task:
Function Random(Lowerbound As Long, Upperbound As Long)
Random = Int(Rnd * Upperbound) + Lowerbound
End Function
...
Let route = Random(1, 3)
If route = 1 And chkuppercase.Value = 1 Then ' generate an uppercase letter
For r = 1 To txtLen.Text
Let m = Random(65, 90)
output = output & Chr(m)
Next r
End If
If route = 2 And chklowercase.Value = 1 Then ' generate a lowercase letter
For r = 1 To txtLen.Text
Let n = Random(97, 122)
output = output & Chr(n)
Next r
End If
If route = 3 And chknumber.Value = 1 Then ' generate a number
For r = 1 To txtLen.Text
output = output & Random(0, 9)
Next r
End If
i don't know if anyone can understand what exactly i've done with the code or the role of all the variables, but allow me to tell you what happens as a result of execution:
1. a random number within the respective ASCII range (uppercase 65-90, lowercase 97-122) is stored in variable m or n. m corresponds to uppercase letters, n with lowercase letters.
2. a chr(m) and chr(n) statement (is supposed to) append the corresponding character or number to string 'output.'
3. string 'output' ends up consisting of a bunch of gibberish hash marks and non-alphanumeric characters. sometimes i do get actual numbers or text, but not often.
so, any ideas as to why i'm not getting actual alpha/numeric output all the time? all i could find in my own research was somebody using a non-system font having this problem, but i tried terminal, times new roman, lucida console, ms sans serif; every default font i could think of but it didn't make a difference.
i suspect there may be a problem with my randomize function...?
thanks