unirand: random number generation thread-safety fix