Posts: 2,857
Threads: 62
Joined: Dec 2010
Reputation:
0
Hi, how can i generate a random text string from out of nowhere?
(I'm currently using exec plugin to execute the pwgen command to a file - then reading the file with fread.)
Posts: 427
Threads: 11
Joined: Apr 2009
Reputation:
0
When you say out of nowhere , what you mean by saying this?
Posts: 2,857
Threads: 62
Joined: Dec 2010
Reputation:
0
For example "Oochah9e" is a random string.
Posts: 427
Threads: 11
Joined: Apr 2009
Reputation:
0
And why you want to use the random string or whatever you call it?
Posts: 2,593
Threads: 34
Joined: Dec 2007
Quote:
Originally Posted by RyDeR`
pawn Code:
stock randomString(strDest[], strLen = 10) { while(strLen--) strDest[strLen] = random(2) ? (random(26) + (random(2) ? 'a' : 'A')) : (random(10) + '0'); }
Example:
pawn Code:
new string[10] ; randomString(string, 10);
|
string[9] = random(bla bla) = crash, must be +1
:> string[10] = EOS