finish first version of the random generation