Generating Random Strings..
Author |
Message |
crimsonXess
|
Posted: Wed Oct 15, 2008 5:23 pm Post subject: Generating Random Strings.. |
|
|
For my game i need to generate 3 random strings 'r' 't' 'y', and i don't have the slightest idea on how to go about it anyone got any answers? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
HellblazerX
|
Posted: Wed Oct 15, 2008 5:38 pm Post subject: RE:Generating Random Strings.. |
|
|
Do you mean create random strings given those 3 letter? If that was the case, you could represent each letter by a number and use the Math.random function to randomize your strings. |
|
|
|
|
|
crimsonXess
|
Posted: Wed Oct 15, 2008 7:22 pm Post subject: Re: Generating Random Strings.. |
|
|
Do you mind giving me that info in more detail...im a total noob |
|
|
|
|
|
The_Bean
|
Posted: Wed Oct 15, 2008 7:26 pm Post subject: Re: Generating Random Strings.. |
|
|
Do you mean random letters in the strings:
string1 = "sdkfhj;ladfka"
string2 = "adnsjknarun"
string3 = "aksdncjkrn"
or do u mean a random order of the strings you already have:
str1,str2,str3
str2,str3,str1
str2,str1,str3
str3,str1,str2
... |
|
|
|
|
|
Tony
|
Posted: Wed Oct 15, 2008 8:12 pm Post subject: RE:Generating Random Strings.. |
|
|
I don't think it matters -- the process is the same (it's the same as one would generate a "random" number); the difference is in the alphabet of the target language. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
crimsonXess
|
Posted: Wed Oct 15, 2008 9:19 pm Post subject: Re: Generating Random Strings.. |
|
|
Yes..what tony said, i know that but with the random int for character...
and i need it to be
string 1,string2,string3
string 2,string1,string3
etc...
that way thnz
|
|
|
|
|
|
andrew.
|
Posted: Sat Oct 18, 2008 12:04 am Post subject: RE:Generating Random Strings.. |
|
|
Well you could use Rand.Int (or randint, I forgot which is better) and make it choose from 1 to 3. Use if statements so that 1 would be r or whatever, 2 would be whatever and so on. Then just put the letters that correspond with the numbers (what you used in the if statement). I hope I am making this clear. |
|
|
|
|
|
|
|