finished 2 functions - random_gen and chk_sorting