Implemented stdlib rand functions