New random function now works as expected.