fix issue with rng thread-safety and size < 0