2

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!

Community
  • 1
  • 1
user2359494
  • 731
  • 5
  • 18
  • 1
    You might like to read this, about when to use brackets and when to use parentheses in NetLogo: http://netlogo-users.18673.x6.nabble.com/Help-About-Brackets-td5003911.html – Seth Tisue Jan 16 '14 at 14:53

1 Answers1

1

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

enter image description here

Marzy
  • 1,884
  • 16
  • 24