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

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