Nistor Mihnea
Nistor Mihnea

Reputation: 11

netlogo - Random forward -

my code is:

to move  
  rt random 100
  lt random 100
  fd 20

  set energy energy - 0.5
end

I want to set fd between two values or maybe greater and lower than a value in the same time.Is this possible?

Upvotes: 0

Views: 74

Answers (1)

JenB
JenB

Reputation: 17678

As with any other random number in a range, you can simply add a constant to a random number drawn from a range. For example, if you want to go forward between 10 and 30, then you add 20 to a number in the range 0-10. That would look like:

forward 20 + random-float 10

Upvotes: 1

Related Questions