Skip to content

MathUtil.setSeed(0) stalls random number generation #35

@jonathanschilling

Description

@jonathanschilling

Hi,

first of all, thanks for UJMP!
I started to use it in a project now and stumbled over the following problem.

For reproducability, I would like to set the random seed.
A nice neutral value that works in other places as well is 0.
However, when I set the random seed to 0 in UJMP's MathUtil, the programs hangs when asked to actually generate random data.

Here is a minimal non-working example:

import org.ujmp.core.Matrix;
import org.ujmp.core.util.MathUtil;

public class TestRandomSeed {
	public static void main(String[] args) {
		MathUtil.setSeed(0); // stalls forever
		// MathUtil.setSeed(1); // works
		Matrix a = Matrix.Factory.randn(3, 3);
		System.out.println(a);
	}
}

The program works when I set the random seed to 1.
Expected behavior: print a (3x3) matrix to the console, filled with random data, after no more than 1 second.

I used UJMP via Maven in an Eclipse Java project:

<dependency>
	<groupId>org.ujmp</groupId>
	<artifactId>ujmp-core</artifactId>
	<version>0.3.0</version>
</dependency>

Thanks for your support!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions