tulamide, ah I found random doesn't spit out nice integers for me like I try to force it into, although the clamp wouldn't solve that either.@Jayjay: I see. Maybe this could help.
Internally a random function calculates a float that is always greater than 0 (zero) and lesser than the number you hand over. If CC detects a number without fraction part, it returns the calculated float without fraction part, too. That's why the range is [0, i-1]
Throughout CC there's the problem of slight inconsistencies with very small or very high fractional numbers. That's due to the single precision floats CC is based on and can't be avoided. For example, you might experience some number like 1.234e-9 (=0.000000001234) where you expected a 0 (zero).
If you want to have more freedom over the numbers generated by random(), you could use floats instead of integers and do the conversion yourself.
floor(random(3.0)) => integer in the range [0, 2]
round(random(3.0)) => integer in the range [0, 3]
ceil(random(3.0)) => integer in the range [1, 3]
pseudo code
on function "myrandom"
set return value to round(random(param(2) - param(1)) + param(1)
set text to function.myrandom(3, 8) => integer in the range [3, 8]
set text to function.myrandom(2.5, 4.75) => float with integer steps in the range [2.5, 4.5] (2.5, 3.5, 4.5)
Hope it helps :)