Fixed test. To test randomizing is not easy.
Added tests and corrected API docs