Raised This Month: $ Target: $400
 0% 

Generate Random String


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
P4rD0nM3
Veteran Member
Join Date: Feb 2006
Old 01-13-2011 , 16:06   Generate Random String
Reply With Quote #1

Hello, how do you generate a random string with 6 length consisting of numbers and letters?

client_print(client, print_center, "9f343948j");

Kinda like that. Thanks.
P4rD0nM3 is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 01-13-2011 , 16:47   Re: Generate Random String
Reply With Quote #2

Easy.

Code:
GenerateString(const choices[], const num_choices, output[], const len) {     for(new i = 0; i < len; i++)     {         output[i] = choices[random(num_choices)];     }         return len; }

Code:
new const choices[] = "abcdefghijklmnopqrstuvwxyz0123456789"; new string[7]; GenerateString(choices, charsmax(choices), string, charsmax(string)); // string is a random string from given choices
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:05.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode