0

can you guyz help me

how to use random like what is its syntax all my codes using the randoms are from a code i saw once so i took its syntax and u work on but like for strings idk how to use random unless if i make a HashMap like plz guyz help me

4th Jun 2017, 8:41 AM
Ishaq Za'rour
2 Answers
+ 1
You can just use Java Random API. It can generate any primitive data number. As radom numbers are in fact pseudorandom, you can use the seeded constructor. The basic use to generate a random int would be: import java.util.Random; Random randGenerator = new Random(); int randomInt = randGenerator.nextInt(); API link: https://docs.oracle.com/javase/7/docs/api/java/util/Random.html
4th Jun 2017, 8:48 AM
Maria Zheng
Maria Zheng - avatar
0
i want a string
4th Jun 2017, 8:51 AM
Ishaq Za'rour