jeudi 16 février 2017

Java Math.random period

I'm working on a big school project about random numbers, but I can't find the period for Math.random(). One source (http://ift.tt/2loqRZ2) claims it's 2^128-1, but it's unclear to me if I'm using the same version. I have version 7.0.800.15 installed and I'm working an a windows 10 computer. I've tried determining the period with a simple program which saves the first values of:

double num = Math.random();

in an array and then loops until it finds the same values in a row again, thus a period would have passed, but with no result, the period is too long.

So my question is: What is the period of Math.random() on my version? Or: Is there a way to determine the period using a simple program?




Aucun commentaire:

Enregistrer un commentaire