improved random nums generation algo