I don't know how to implement random in imath library for using imath.random() in script and hostlua.
Attached is the patch for this new imath functions:
int(5010) = 5000 / int(-5010) = -5000
frac(5010) = 10 / frac(-5010) = -10
ceil(5010) = 6000 / ceil(-5010) = -5000
floor(5010) = 5000 / floor(-5010) = -6000
round(5010) = 5000 / round(-5010) = -5000