apple / apple/swift-numerics

Normally-distributed random numbers

Open
#101 7 comments 4 reactions 0 assignees View on GitHub
new module
Dominant language
Swift
Stars
1.9k
Forks
181
Avg merge
2d 5h
Merged PRs (30d)
6

Description

It is common to need a random sample from either a real or complex normal distribution.

The standard library provides static `random(in:)` methods which sample uniformly, in a constrained extension of `BinaryFloatingPoint`. (The constraint is `RawSignificand: FixedWidthInteger`.)

I propose that we add similar functionality for sampling from a normal distribution on `Real` and `Complex` with the corresponding constraints.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the standard library's static random(in:) methods and the existing Real and Complex types in Swift Numerics. Define the corresponding normal-distribution sampling APIs and constraints for real and complex values, then verify that both kinds of samples behave as specified.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.