Ensure rng works in R2012
Performance fix for unit arguments