faster randn with ifelse

Thanks to @rfourquet

Backport of #9126
(from 376afcf135e5e209c4a2da3f0d58fb7a79f9e6a2)