Combining random characters to make a string Java -
i trying make program combines group of characters randomly grabbed pool string called name. problem have makes 1 letter, when ends printing 1 letter, when should more.
//determining first name for(int g = 0; g < name_length_first; g++) { char randomchar = pool[random.nextint((pool.length) - 1) + 1]; person_name_first = new stringbuilder().append(randomchar).tostring(); }
how recommend go fixing this?
stringbuilder partialname = new stringbuilder(); for(int g = 0; g < name_length_first; g++) { char randomchar = pool[random.nextint((pool.length) - 1) + 1]; partialname.append(randomchar); } person_name_first = partialname.tostring();
Comments
Post a Comment