changed random number generating func to NC ran2 and fixed the bug of seeding before every call to ran2()