Joe118 3 Posted June 19, 2010 Report Share Posted June 19, 2010 Is it possible to generate a random string of N characters? I'd like to do something like this (mock up code) vowels = 'a' 'e' 'i' 'o' 'u' 'y'; consonants = 'b' 'c' .. 'z'; thestring = ""; for (i = 0; i < N; i++) { if (random(1,2)) { thestring += consonants[random(0,length(consonants)-1)]; } else { thestring += vowels[random(0,length(vowels)-1)]; } } dosomething_with(thestring); Thanks for any ideas. --Joe Quote Link to post Share on other sites
Joe118 3 Posted June 19, 2010 Author Report Share Posted June 19, 2010 OK so answering my own question, its easy to do with $random list item. Quote Link to post Share on other sites
alcr 135 Posted June 20, 2010 Report Share Posted June 20, 2010 Great that you solved it Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.