I'm trying to have NetLogo draw values from a bounded random normal distribution following the recommendation in a previous question in stackoverflow
NetLogo : How to make sure a variable stays in a defined range?
Specifically I'm asking the model to create a circular home range that varies in size according to empirical data
set homerange patches in-radius ((sqrt (( random-normal-in-bounds [ 54.4 35.8 19 151 ] * 1000000)/ pi))/ 100)
to-report random-normal-in-bounds [mid dev mmin mmax]
let result random-normal mid dev
if result < mmin or result > mmax
[ report random-normal-in-bounds mid dev mmin mmax ]
report result
end
However I keep getting the error that random-normal-in-bounds expected 4 inputs. I'm sure it's something silly I'm doing but it looks like 4 inputs (54.4, 35.8, 19, 151) to me. Any suggestions on what I'm doing wrong? Thanks in advance!
I think your error is caused by [] you don't need these brackets.
Update:
to test
clear-all
let homerange nobody
let radius sqrt (( random-normal-in-bounds 54.4 35.8 19 151 * 1000000)/ pi) / 100
crt 1 [
set homerange patches in-radius radius
]
ask homerange [set pcolor violet]
end
to-report random-normal-in-bounds [mid dev mmin mmax]
let result random-normal mid dev
if result < mmin or result > mmax
[ report random-normal-in-bounds mid dev mmin mmax ]
report result
end
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments