added random function

implemented and defined random function