For example, if I have a class:
public class Class
{
public Random r;
public Class()
{r= new Random()}
}
and then create two instances:
Class a = new Class();
Class b = new Class();
and call r sequentially, r for both will give the same value. I read that this is because the default constructor for Random uses time to provide "randomness", so I was wondering how I can prevent this. Thanks in advance!
source
share