I have a few variables which can be inherited to child agents by a variation of + 0.1 and -0.1 or without any changes, or random again, What I have done is like this: (The
My favorite trick is this:
set x median (list 0 (y) 1)
Where y is the random number (or put in an expression), 0 is the minimum, and 1 is the maximum.
It works because if y is greater than 1, then the median will be 1. If y is less than 0, then the median will be 0. Otherwise the median is y.
For example, here is the random number in your example clamped to the range [0, 1]:
to test
let b median (list 0 (random-normal 0.5 0.1) 1)
print b
end