implement random. Fixes #4