Use a local variable hoist to make invoking the random function faster.