added randomize function to Graph