fork(1) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. Ideone i = new Ideone();
  13. }
  14.  
  15. public Ideone(){
  16. // new A(3,20);
  17. new N(3,20);
  18. }
  19.  
  20. class N extends java.util.Random{
  21. N(int s,int n){
  22. super(s);
  23. for(float a,v=0;
  24. n-->0;
  25. System.out.println(v*Math.sqrt(-2*Math.log(a)/a)))
  26. for(a=0;
  27. a>=1|a==0;
  28. a=v*v+(v=2*nextFloat()-1)*v)v=2*nextFloat()-1;
  29. }
  30.  
  31. class A extends java.util.Random{A(int s,int n){super(s);for(s=0;++s<n;System.out.print(Math.sqrt(-2*Math.log1p(nextDouble()))*Math.cos(2*Math.PI*Math.cos(nextDouble()))));}}
  32.  
  33. class B extends java.util.Random{
  34. B(int s,int n){
  35. super(s);
  36. // for(s=0;s++<n;
  37. for(;n-->0;
  38. System.out.println(Math.sqrt(-2*Math.log(nextDouble()))*Math.cos(2*Math.PI*nextDouble())));
  39. }
  40.  
  41. }
  42. }
  43. }
Success #stdin #stdout 0.1s 320256KB
stdin
Standard input is empty
stdout
0.4476313163109632
0.13222421393394837
0.41285373933697433
0.5372579556786695
-1.233572308245029
-0.07763851140364825
-0.31152663580859363
0.4731236873284842
0.15603222911195333
-1.1205491931049911
-0.018486114084235665
0.15105880620983145
-1.7305853971626917
-2.1099846261319266
-0.7330718685866893
0.3903681832045495
0.5305636174954023
-0.993498167218645
-0.3245812767832808
2.3500480827257864