mercredi 29 juillet 2020

Generate a number within a range and considering a mean val

I want to generate a random number within a range while considering a mean value.

I have a solution for generating the range:

turtles-own [age]

to setup
  crt 2 [
   get-age 
  ]     
end

to get-age
  let min-age 65
  let max-age 105
  set age ( min-age + random ( max-age - min-age ) )
end

However, if I use this approach every number can be created with the same probability, which doesn't make much sense in this case as way more people are 65 than 105 years old. Therefore, I want to include a mean value. I found random-normal but as I don't have a standard deviation and my values are not normally distributed, I can't use this approach.




Aucun commentaire:

Enregistrer un commentaire