mitsuba-af602c6fd98a/src/tests/test_random.cpp
/* Basic test: the expected value should be 0.5 */
Basic test: the expected value should be 0.5
Basic test : the expected value should be 0 . 5
void TestRandom::test01_mean()
{
	ref<Random> rnd = new Random;
	double sum = 0.0;
	const int N = 1000000;
	for (int i = 0; i < N; ++i) {
		sum += rnd->nextFloat();
	}
	sum /= N;
	assertEqualsEpsilon(static_cast<Float>(sum), 0.5f, 1e-3f);
}
void TestRandom :: test01_mean ( ) { ref < Random > rnd = new Random ; double sum = 0.0 ; const int N = 1000000 ; for ( int i = 0 ; i < N ; ++ i ) { sum += rnd -> nextFloat ( ) ; } sum /= N ; assertEqualsEpsilon ( static_cast < Float > ( sum ) , 0.5f , 1e-3f ) ; }
Basic test: the expected value should be 0.5
Basic test : the expected value should be 0 . 5