Consider the following code, you find what is special about it?
Special features: two square calculation method name and parameter types are not the same return type, argument types due to different methods, the method of forming Overloaded.
Pure random number generator
= 231-1 = Int.MaxValue the Modulus
Multiplier = 16807 = 75
C = 0
when the number of displayed through 231-2, it may be repeated.
Write a method, using the above algorithm to generate a random integer to specify the number (such as 1000) of.
package 随机数; import java.util.Random; public class kk { public static void main(String[] args) { Random ran = new Random( System.currentTimeMillis() ); int x; x=ran.nextInt(1000); for(int i=1;i<=1000;i++) { System.out.println(x+"\t"); x=(5*x+4)%(99999999); } } }