Use R's random number generator instead of C