Write some function for random generator.