Skip to content

provide all random number generators provided by numpy #137

@gdementen

Description

@gdementen

We cannot do this in a "future-proof" way (without somehow listing the functions) because we need the
type information.

  • create a special "random" symbol/pseudo-module and add attributes
  • use the following code to get/update the list:
import numpy as np

names = [n for n in dir(np.random)
         if (not n.startswith('__') and
             n not in {'RandomState', 'Tester', 'absolute_import', 'bench',
                       'division', 'get_state', 'info', 'mtrand', 'np',
                       'operator', 'print_function', 'seed', 'set_state',
                       'test', 'warnings'})]
argspecs = [getattr(np.random, n).__doc__.splitlines()[1].strip()
            for n in names]
print('\n'.join(argspecs))
  • make utils.argspec accept a (single) string to make it easier to update. Not sure if it should take a string including the function name eg "random_integers(low, high=None, size=None)" or only the string for arguments, eg "low, high=None, size=None"

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions