Skip to content

Commit c8bc266

Browse files
committed
DOC: Add alias docstrings for sample and ranf
Add docstring and add to __all__
1 parent 09bdc6e commit c8bc266

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

numpy/random/mtrand.pyx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4142,9 +4142,7 @@ randn = _rand.randn
41424142
random = _rand.random_sample
41434143
random_integers = _rand.random_integers
41444144
random_sample = _rand.random_sample
4145-
ranf = _rand.random_sample
41464145
rayleigh = _rand.rayleigh
4147-
sample = _rand.random_sample
41484146
seed = _rand.seed
41494147
set_state = _rand.set_state
41504148
shuffle = _rand.shuffle
@@ -4160,6 +4158,21 @@ wald = _rand.wald
41604158
weibull = _rand.weibull
41614159
zipf = _rand.zipf
41624160

4161+
# Old aliases that should not be removed
4162+
def sample(*args, **kwargs):
4163+
"""
4164+
This is an alias of `random_sample`. See `random_sample` for the complete
4165+
documentation.
4166+
"""
4167+
return _rand.random_sample(*args, **kwargs)
4168+
4169+
def ranf(*args, **kwargs):
4170+
"""
4171+
This is an alias of `random_sample`. See `random_sample` for the complete
4172+
documentation.
4173+
"""
4174+
return _rand.random_sample(*args, **kwargs)
4175+
41634176
__all__ = [
41644177
'beta',
41654178
'binomial',
@@ -4193,7 +4206,9 @@ __all__ = [
41934206
'randn',
41944207
'random_integers',
41954208
'random_sample',
4209+
'ranf',
41964210
'rayleigh',
4211+
'sample',
41974212
'seed',
41984213
'set_state',
41994214
'shuffle',

0 commit comments

Comments
 (0)