David is correct - you can fix this (provided you're not using multithreading) by making the Random instance static:
class ItemClass
{
private static Random r = new Random(); //Share one instance across all ItemClass instances
private int id { get; set; }
public double[] ws { get; set; }
public ItemClass(int identifier)
{
id = identifier;
ws = new double[10];
for (int z = 0; z < 10; z++)
{
ws[z] = r.NextDouble(); // Use the static instance
}
}
}
No comments:
Post a Comment