implemented through chap 6, ex 7, with scalatest for methods
chap 6, exercise 8: RNG.flatMap
chap 6, exercise 9