I'm trying to replace all even numbers in a string with odd numbers that are produced from a random generator. I have somewhat of an idea of how to do it as far as creating an array of 5 characters(1,3,5,7,9) and then implement the math.random to take random numbers from that array. i just dont know how to execute that. for example:
"adam123456789" -->should be "adam1
53
15
77
39"
whereas, the underlined(5,1,7,3) should be random numbers(i just picked these for an instance). is it possible to do any form of :
Methods...
char [ ] ary = {1,3,5,7,9};
String line = "adam123456789";
line = line.replaceAll("[0,2,4,6,8]", Math.round(Math.random()*[ary]));
return line;
**i'm a beginner, so i dont really know what im talking about. just seeking help. thanks!