Switched to a temporary allocation in a random function.