18 lines
402 B
Plaintext
18 lines
402 B
Plaintext
class Main
|
|
{
|
|
static const Float PI := 0.0f.acos * 2 // we need to precompute PI
|
|
|
|
static Float randomNormal ()
|
|
{
|
|
return (Float.random * PI * 2).cos * (Float.random.log * -2).sqrt
|
|
}
|
|
|
|
public static Void main ()
|
|
{
|
|
mean := 1.0f
|
|
sd := 0.5f
|
|
Float[] values := [,] // this is the collection to fill with random numbers
|
|
1000.times { values.add (randomNormal * sd + mean) }
|
|
}
|
|
}
|