18 lines
462 B
Text
18 lines
462 B
Text
bundle Default {
|
|
class RandomNumbers {
|
|
function : Main(args : String[]) ~ Nil {
|
|
rands := Float->New[1000];
|
|
for(i := 0; i < rands->Size(); i += 1;) {
|
|
rands[i] := 1.0 + 0.5 * RandomNormal();
|
|
};
|
|
|
|
each(i : rands) {
|
|
rands[i]->PrintLine();
|
|
};
|
|
}
|
|
|
|
function : native : RandomNormal() ~ Float {
|
|
return (2 * Float->Pi() * Float->Random())->Cos() * (-2 * (Float->Random()->Log()))->SquareRoot();
|
|
}
|
|
}
|
|
}
|