Using -O with DMD seems to produce non-random values.

Kagamin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu May 19 08:42:23 PDT 2016


how this works?

double[] generateValues(ref Random rand, int l)
{
	auto values = new double[](l);
	foreach (ref val; values)
	{
		auto value = 1;
		if (uniform(0, 2, rand))
		{
			value = value * -1;
		}
		val = value;
	}

	return values;
}


More information about the Digitalmars-d-learn mailing list