java se8 rand gauss secure? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

java se8 rand gauss secure?

Hi everybody! Its been a long time since i have been here, i would like u to kno that i app reciate u guys, (joke). i was wondering if the java se8 random gaussian was cryptographically secure, and why or why not, as opposed to fortuna, or cha, or dh, import java.util.*; public class Jrandgauss{Jrandgauss(){} long t1=0;long t2=0;int r=0;double r1=0;double r2=0;int bits=0;int seed=0; Random rnd = new Random(); public void Random(long seed){rnd.setSeed(seed);} public void setSeed(long seed){t1=seed^0x5DEECE66DL;} //& ((1L << 48) - 1);} protected long next(long bits){t2=seed*0x5DEECE66DL+0xBL;return t2;} //& ((1L << 48) - 1);} //return((int)(seed >>> (48 - bits))); public double nextDouble() {rnd.setSeed(seed); return (((long)next(26) << 27) + next(27)) / (double)(1L << 53);} private double nextNextGauss; private boolean haveNextNextGauss = false; public double nextGauss() {if (haveNextNextGauss) { haveNextNextGauss= false; return nextNextGauss;} else {double v1, v2, s; do { v1 = 2 * nextDouble() - 1; // between -1.0 and 1.0 v2 = 2 * nextDouble() - 1; // between -1.0 and 1.0 s = v1 * v1 + v2 * v2;} while (s >= 1 || s == 0); double mult = StrictMath.sqrt(-2 * StrictMath.log(s)/s); nextNextGauss= v2 * mult;haveNextNextGauss= true; return v1 * mult;}} //:: //mult=((-2)*((ln(int^((maxlong/1M)-1))/(int^((maxlong/1M)-1))^(1/2); public static void main(String[] args) {} //for (s in range(r)){r2=(mult-(mult-s)); //return r2; }//Cleaned version.

25th Aug 2020, 4:32 PM
AW4
AW4 - avatar
1 Answer
+ 2
i was also wondering how you would get an original int back from any of these.
25th Aug 2020, 4:33 PM
AW4
AW4 - avatar