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? |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
HellblazerX
![](http://www.plamania.co.kr/shopimages/plmtest/2910040000213.jpg)
|
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. |
|
|
|
|
![](images/spacer.gif) |
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 ![Neutral Neutral](http://compsci.ca/v3/images/smiles/icon_neutral.gif) |
|
|
|
|
![](images/spacer.gif) |
The_Bean
![](http://compsci.ca/v3/uploads/user_avatars/8459755754b4009cee84e9.jpg)
|
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
... |
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
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. |
|
|
|
![](images/spacer.gif) |
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
![Smile Smile](http://compsci.ca/v3/images/smiles/icon_smile.gif) |
|
|
|
|
![](images/spacer.gif) |
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. |
|
|
|
|
![](images/spacer.gif) |
|
|