Originally posted by Sam Bluesman:
Is it possible to generate a random character in a similar way it is to generate a random number using, say, the system clock, or would it be better to set up an array that holds all the characters in and work through that? I need to use single characters as a unique identifier you see.
Cheers
Either way sounds feasible. The algorithm you choose will depend on the requirements and what kind of "randomness" you desire. Do you need to avoid duplicates? If so, then you probably want to use a List of available chars and remove the ones that have been used. This is a fairly common way to pick anything at random without duplication.
On the other hand, if you don't care about duplicates, generating a random number between 'a' and 'z'. Since characters are really numerical values that use the Unicode character set to translate into a char, you can generate numbers between the Unicode values of 'a' and 'z'. So you might want to start this approach by writing a small methd that returns a random number between some min and max values that are passed in as parameters.
Layne