Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Random letters

by plaid (Chaplain)
on Apr 12, 2000 at 04:10 UTC ( #7354=note: print w/replies, xml ) Need Help??


in reply to Random letters

The easiest way I can see to do it would be taking the random number you get and using it as an index into an array of letters. Something that looks like the following:
@letters = ('a'..'z'); # or ('A'..'Z') or ('a'..'z', 'A'..'Z'), etc +. $letter = $letters[ int rand scalar @letters ];
Which could be further condensed down if you only wanted to use this method once and wanted to make your code a little harder to read.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://7354]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2022-05-18 12:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (70 votes). Check out past polls.

    Notices?