I have a method that creates an array of random doubles between -1.0 and 1.0
private double[] noise(int length)
{
Random randn = new Random();
double[] n = new double[length];
for (int i = 0; i < length; i++)
n[i] = 2.0 * (randn.NextDouble() - 0.5);
return n;
}
When I create two arrays using this method the contents arr1 and arr2 are identical.
double[] arr1 = noise(100);
double[] arr2 = noise(100);
Aucun commentaire:
Enregistrer un commentaire