How can I use $urandom/$random with range?

In reply to saritr:

The modulus (%) operator gives you the range, so you just increase the range by the minimum value.


temp = ($urandom % (max - min + 1)) + min;