Ported the mathlib (and added a per-VM random number generator).