mod: properly set up random number generator