Fix for crash in dots part on Android
RAND_MAX is 2^31 on Android, and breaks where calculations expect it to be 2^15.
Added new fcrand() function which ensures the random is clamped to 2^15.