A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
How do i create random strings?
Joined: May 29, 2001
May 29, 2001 13:31:00
I need a no paramater constructor that generates a random 4 letter
. Is there a way to do this using Math.random?
Joined: Feb 26, 2001
May 29, 2001 13:41:00
char randomLetter = (char)('A' + (Math.random() * 26));
I'm leaving the rest for you to figure out just in case this is a school assignment
Junilu - [
How to Ask Questions
How to Answer Questions
Joined: Oct 19, 2000
May 30, 2001 06:46:00
You could create a collection of the 26 characters, shuffle the Collection and select four elements.
Don't get me started about those stupid
subject: How do i create random strings?
Help with random class
Random Number Chooser programming exercise
WA #1.....word association
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014