Link to home
Start Free TrialLog in
Avatar of Terramoto
Terramoto

asked on

infinite range a..z..0..9

Hi! im a kylix developer and i just want to know how to make a infine range with numbers and letters.
sorry about my English, im a portuguese :p
thank you.
ASKER CERTIFIED SOLUTION
Avatar of BlackTigerX
BlackTigerX

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of aikimark
Terramoto,

Do you want to create a base36 or base62 numbering system?
Avatar of Terramoto
Terramoto

ASKER

base36 dont understand :\
but is the code that BlackTigerX posted :) thank you! :p
base36 or baseX refers to how many digits you use, for example:

binary is base 2, there are only 2 digits 0 and 1 (you can say binary=base2)
decimal is base 10, there are 10 digits, from 0 to 9 (you can say decimal=base10)

base36 would be 36 digits, so in that case you would use all the numbers and all the letters to get 36 different digits

there are others very used, like octal (8 digits, from 0 to 7) and hexadecimal (16 digits, from 0 to F)
...and in base62, you use all the digits as well as the lower case letters and the upper case letters.

0...9abc...xyzABC...XYZ

 10  +  26    +   26       =62

~~~~~~~~~~~~~
On some URL links you may see, they are using more characters (=~%^ etc.) which provides an even larger base than 62.  I've created and used such an alphabet in one of my applications.  In this case, randomly selected (printable) ASCII characters and stored them in an array.  Then I used the record's (long integer) autonumber record key (setting the ID's value selection to random) as a random number seed.  I looped through a fixed number of times (30), generating a random number and using that random number as an index in my 'alphabet' array and concatenating the selected character (for that iteration) to the hyperlink we emailed.  The character string was also placed in the record for later retrieval.  

This was done to prevent hackers from supplying sequential numbers to our web site an view someone's data or enter their data under the guise of someone else's ID.
This resulted in a MUCH larger number of key values than actually existed:
2^32   = 4.295E+09 <= number of possible long integer values
62^30 = 5.912E+53 <= number of possible generated character strings
In your case, 25 characters of base62 would result in 6.453E+44 possible combinations.

25 characters of base36 would result in 8.0828E+38 possible combinations.