Skip to content

Commit

Permalink
Merge pull request #17 from UBC-MDS/rnorm
Browse files Browse the repository at this point in the history
added docstrings as well as empty test for rnorm function
  • Loading branch information
jasonmlee authored Jan 9, 2025
2 parents ac5d423 + cd69563 commit 9e833bd
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/pystats/rnorm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
def rnorm(n, mean=0, sd=1):
"""
This function generates a vector (NumPy array) of length n normally distributed
random variables with mean equal to the `mean` and sd equal to the `sd`.
Parameters
----------
n : int
The number of random variables to be simulated.
mean : float, optional
The mean value of the normal distribution. Default is 0.
sd : float, optional
The standard deviation of the normal distribution. Default is 1.
Returns
-------
numpy.ndarray
A NumPy array of length n containing normally distributed random variables
with mean equal to `mean` and sd equal to `sd`.
Examples
-------
>>> rnorm(2, mean=5, sd=2)
array([6.3245, 4.5983])
"""
1 change: 1 addition & 0 deletions tests/test_rnorm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from pystats.rnorm import rnorm

0 comments on commit 9e833bd

Please sign in to comment.