Java generates random integers in different methods. For details, refer to the following code:
Import Java. security. securerandom; <br/> Import Java. util. random; <br/>/** <br/> * aiguoxin 2010-10-20 01:35:13 <br/> * Summary of Random Number Generation <br/> */<br/> Public class Radom {<br/> Public static void main (string [] ARGs) {<br/> // math. random () method <br/> for (INT I = 0; I <10; I ++) {<br/> system. out. print (INT) (math. random () * 100) + ""); <br/>} system. out. println ("/N" + "---------------------------"); <br/> // random numbers are different each time without seeds. <br/> random Rand = new random (); <br/> for (INT I = 0; I <10; I ++) {<br/> system. out. print (Rand. nextint (100) + ""); <br/>}< br/> system. out. println ("/N" + "---------------------------"); <br/> // with seeds, the random number is the same each time <br/> random rand2 = new random (10 ); <br/> for (INT I = 0; I <10; I ++) {<br/> system. out. print (rand2.nextint (100) + ""); <br/>}< br/> system. out. println ("/N" + "---------------------------"); <br/> // generate a random number that is completely unique <br/> securerandom random = new securerandom (); <br/> for (INT I = 0; I <10; I ++) {<br/> system. out. print (random. nextint (100) + ""); <br/>}< br/>}