Added base/rand and associated tests.