Moved all the random util functions out of AST