See SX Microcontroller Math Method - Random