NetLogo : How to make sure a variable stays in a defined range?
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 code is just an example) to reproduce ask turtle 1 [ let X-Of-Mother X hatch 1 [ set X one-of (list (X-Of-Mother) (X-Of-Mother + 0.1) (X-Of-Mother - 0.1) (random-float 1)) ] ] end Currently I have to check if X of child turtle is always within range by something like this: if X > 1 [set X X - 0.2] if X < 0 [set X X + 0.2] What could be a better way to do it? What if I have to use random-normal 0.5 0.1 , how can I limit that