Changed to use RNGCrypto for random numbers.