minor change on random function