Search code examples
netlogodistributionexponentialexponential-distribution

How to get a "reverse exponential distribution"?


Suppose I have X patches, and patches have a patch variable called "patch-quality", with values between 0 and 1. I want this patch variable to be generated randomly, but in two different ways (two different scenarios):

  • Scenario 1: random number between 0 and 1 but with most patches with patch-quality close to 0.

  • Scenario 2: random number between 0 and 1 but most patches with patch-quality close to 1.

For Scenario 1 I don't have a problem, I use an exponential distribution with a mean of 0.13.

if (patch-quality-distribution = "scenario-1") [set patch-quality random-exponential 0.13]

My problem is with Scenario 2. I want an exponential distribution like the one with scenario 1 but "in reverse". Is there a way to have a sort of reverse exponential distribution in NetLogo where most patches have a patch-quality close to 1?


Solution

  • For getting that reverse exponential distribution (not inverse, as @pjs pointed out in his comment), you can use:

    [set patch-quality (1 - random-exponential mean_value)]