I'm not asking if these are truly random. I just wanted to know if two users hit the a page at the same time can they get the same random number? I'm thinking if i run this on a multicore server will i generate the same randon number a good amount of time due to syncing or whatever other reasons?
public static class SBackend
{
static Random randObj = null;
public static void init()
{
randObj = new Random((int)DateTime.Now.ToBinary());
runFirstTime();
}
public static long getRandomId()
{
long randNum = (long)randObj.Next() << 33;
randNum |= (uint)randObj.Next() << 2;
randNum |= (uint)randObj.Next() & 3;
return randNum;
}
}