user
Task

Generate a collection filled with   **1000**   normally distributed random (or pseudo-random) numbers
with a mean of   **1.0**   and a   standard deviation   of   **0.5**

Many libraries only generate uniformly distributed random numbers. If so, you may use one of these algorithms.

Related task

* Standard deviation
assistant
(formerly Perl 6)

**Works with**: Rakudo version #22 "Thousand Oaks"

```
sub randnorm ($mean, $stddev) {
    $mean + $stddev * sqrt(-2 * log rand) * cos(2 * pi * rand)
}

my @nums = randnorm(1, 0.5) xx 1000;

# Checking
say my $mean = @nums R/ [+] @nums;
say my $stddev = sqrt $mean**2 R- @nums R/ [+] @nums X** 2;

```