made wprandom.pl into a function...