fork download
  1.  
  2. //Name = MD Saimon islam sakib.
  3. // Internal ID = 240242058
  4.  
  5. public class Main{
  6. public static void main(String[] args) {
  7. int a = 5;
  8. int c = 3;
  9. int m = 16;
  10. int X = 1;
  11.  
  12. System.out.println("LCG Generated Numbers:");
  13. for(int i = 0; i < 10; i++) {
  14. X = (a * X + c) % m;
  15. System.out.println(X + " (Normalized: " + ((double)X/m) + ")");
  16. }
  17. }
  18. }
Success #stdin #stdout 0.2s 56028KB
stdin
Standard input is empty
stdout
LCG Generated Numbers:
8  (Normalized: 0.5)
11  (Normalized: 0.6875)
10  (Normalized: 0.625)
5  (Normalized: 0.3125)
12  (Normalized: 0.75)
15  (Normalized: 0.9375)
14  (Normalized: 0.875)
9  (Normalized: 0.5625)
0  (Normalized: 0.0)
3  (Normalized: 0.1875)