I am building a computational simulation (Netlogo) of the spread of disinformation. For a start, I want to distribute the political preference of the population following a basic Gaussian distribution (later on I can adjust the distribution to my liking). I know that the Box Muller Transform is the easiest way to do this. However, when implementing it, I find that the plot always has a tendency to lean to the right. Does someone know why this is and how I can prevent it? Also, y2 gives a very different plot than y1. When looking it examples of Box Muller, they all show two plots with similar Gaussian distribution. Does someone also know the reason for this doesn't happen with my code? I used the following code:
let u1 random-float 1
let u2 random-float 1
let z1 sqrt (-2 * ln u1) * cos (2 * pi * u2)
let z2 sqrt (-2 * ln u1) * sin (2 * pi * u2)
report z1
random-float 1 means it will pick a floating point number between 0 and 1. Thanks in advance!