From: Idon Havone on 13 Aug 2010 18:55 How to write a function that generates a random 5 digit name?
From: Ross W on 13 Aug 2010 19:19 "Idon Havone" <idonhavone(a)yahoo.com> wrote in message <i44igo$lt1$1(a)fred.mathworks.com>... > How to write a function that generates a random 5 digit name? hi how about this? name_length=5; list=char(abs('a'):abs('z')); %one way of getting 'abcdefg ...xyz' random_indices=randi(numel(list),1,name_length); %read the help for randi random_name=list(random_indices); Ross
From: Wayne King on 13 Aug 2010 20:31 "Idon Havone" <idonhavone(a)yahoo.com> wrote in message <i44igo$lt1$1(a)fred.mathworks.com>... > How to write a function that generates a random 5 digit name? Hi Idon, are you just trying to produce 5 random letters? Another way is char(randi([97 122],1,5)) Just using the ASCII character codes for the Latin alphabet (lower case). Of course if you wanted to add constraints that there has to be a vowel, or no more than a fixed number of consonants together, then things are more complicated. Wayne
|
Pages: 1 Prev: interpolating to create a 3D surface Next: Loops used to flip cell array |