Fixing compilation build warning as exception used as value rather than ref. Seed the Math random part.