Chapter6 RNG part completed