I am trying to generate a list of random numbers that must all add to 1 (or 100 if that's easier) but can't figure out how to do it. I know Netlogo allows you to create random numbers but can't find a way to set the rule that the addition of the generated numbers must be 1. Any help is much appreciated!
Something like this?
let xs n-values 5 [ -> random-float 1 ]
let total sum xs
set xs map [ x -> x / total ] xs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With