Reputation: 171
I am a beginner with Netlogo and I am trying to generate a list with 3 items in it. I want these items to be random floats between 0.95 and 1.05.
I have declared this list as a "turtles-own" variable and I have attempted the following in the setup procedure:
ask turtles [ set fraction-list [ (0.95 + random-float 0.10) (0.95 + random-float 0.10) (0.95 + random-float 0.10) ] ]
Netlogo brings up an error saying: "Expected closing parenthesis." where the first "+" sign in the list is.
I am guessing Netlogo does not let you declare these variable within the list? I also tried to declare three variables beforehand like:
ask turtles [
let x (0.95 + random-float 0.10)
let y (0.95 + random-float 0.10)
let z (0.95 + random-float 0.10)
set fraction-list [ x y z]
]
However another error pops-up. It says "Expected a literal value." where the x is in the list.
Any ideas on how I could generate a list of random-floats within a given interval?
Thanks beforehand,
Carlos
Upvotes: 1
Views: 1288