nth rand r (x:y:zs)
  | r <= rand = x
  | otherwise = nth rand (r*r) (y:zs)
nth rand r (x:y:zs)
  | r <= rand = x
  | otherwise = nth rand (r*r) (y:zs)
nth rand r (x:y:zs)
  | r <= rand = x
  | otherwise = nth rand (r*r) (y:zs)