@Test
    public void testRandomInitializer() {
	Environment.getInstance().setUseWeightsSharedMemory(true);
	NeuralNetworkImpl nn = NNFactory.mlp(new int[] { 3, 2 }, true);
	NNRandomInitializer rand = new NNRandomInitializer(new MersenneTwisterRandomInitializer(-0.1f, 0.1f), 0.5f);
	rand.initialize(nn);

	for (Layer l : nn.getLayers()) {
	    if (Util.isBias(l)) {
		Tensor t = ((FullyConnected) l.getConnections().get(0)).getWeights();
		float[] elements = t.getElements();
		t.forEach(i -> assertEquals(0.5, elements[i], 0f));
	    } else {
		Tensor t = ((FullyConnected) l.getConnections().get(0)).getWeights();
		float[] elements = t.getElements();
		t.forEach(i -> assertTrue(elements[i] >= -0.1f && elements[i] <= 0.1f && elements[i] != 0));
	    }
	}

	rand = new NNRandomInitializer(new MersenneTwisterRandomInitializer(2f, 3f), new MersenneTwisterRandomInitializer(-2f, -1f));
	rand.initialize(nn);

	for (Layer l : nn.getLayers()) {
	    if (Util.isBias(l)) {
		Tensor t = ((FullyConnected) l.getConnections().get(0)).getWeights();
		float[] elements = t.getElements();
		t.forEach(i -> assertTrue(elements[i] >= -2f && elements[i] <= -1f));
	    } else {
		Tensor t = ((FullyConnected) l.getConnections().get(0)).getWeights();
		float[] elements = t.getElements();
		t.forEach(i -> assertTrue(elements[i] >= 2f && elements[i] <= 3f));
	    }
	}
    }