lua-users home
lua-l archive

Re: string.random

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Dear Adrian,
thank you for your good help. Indeed your code is faster. To produce
5000 times an 32 char-random-string with the pattern %l%d my simple
version needs about ~1.9 sec and your tuned version needs ~0.7 sec.
Some corrections:
do -- block for upvalues --> not needed
Built = {'.',AllChars} --> Built={['.']=Chars}
string.sub(S,Loop,Loop+1) --> string.sub(S,Loop,Loop)
I will place the tested code to the lua-wiki.
--
Markus

AltStyle によって変換されたページ (->オリジナル) /