Changed rand() calls to bm_rand() if they should be mockable, and mt_rand() if not

Fixes #1228.

http://jenkins.buttonweavers.com:8080/job/buttonmen-blackshadowshade/409/