added some misc helper function to rand module
Merge branch 'master' into trace
misc fixes
added some more tests

algorithm not working so great on random trees :\