Random function fix