Author Topic: [Resource] GenRandomMix  (Read 713 times)

GenRandomMix, creates a mixture of random numbers and letters.
From a T3D project I made a while ago.

string GenRandomMix( int NumberOfChars )


Download
Raw
« Last Edit: June 15, 2014, 08:47:44 PM by swatman64 »

Does this do the same thing as
Code: [Select]
//- getRandomString (returns a random string of the specified %length)
function getRandomString(%length)
{
   %numeroalphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
   
   for(%i=0;%i<%length;%i++)
   {
      %string = %string@getSubStr(%numeroalphabet,getRandom(0,strlen(%numeroalphabet)-1),1);
   }
   return %string;
}
?
Mediafire isn't loading for some reason.
« Last Edit: June 15, 2014, 09:41:31 PM by Ninjaman 4 »

Does this do the same thing as
Code: [Select]
function strRandom(%length, %chars)
{
if(%chars $= "")
%chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
%rMax = strLen(%chars) - 1;
for(%i=0;%i<%len;%i++)
%out = %out @ getSubStr(%chars, getRandom(0, %rMax), 1);
return %out;
}
?
Mediafire isn't loading for some reason.

That, um, forget. Thats a lot more efficient than what I did