lundi 6 septembre 2021

In Java generate same random numbers like in Numpy random

Is there any option to generate identicial random numbers in Java like in Numpy random, when using same seed (e.g. 12345).

In Numpy I get for code below output: 0.9296160928171479

from numpy.random import RandomState
rs = RandomState(12345)
rs.random()

In Java I get for code below output: 0.3618031071604718

import java.util.Random;
Random random = new Random(12345);
System.out.println(random.nextDouble());



Aucun commentaire:

Enregistrer un commentaire