I’ve been working with numpy and needed the random.choice() function. Sadly, in version 2.0 it’s not in the random or the random.mtrand.RandomState modules. Has it been excluded for a particular reason? There’s nothing in the discussion or documentation about it!
For info, I’m running Numpy 2.0 on python 2.7 on mac os. All installed from the standard installers provided on the sites.
Thanks!
random.choiceis as far as I can tell part of python itself, not of numpy. Did youimport random?Update: numpy 1.7 added a new function,
numpy.random.choice. Obviously, you need numpy 1.7 for it.Update2: it seems that in unreleased numpy 2.0, this was temporarily called
numpy.random.sample. It has been renamed back. Which is why when using unreleased versions, you really should have a look at the API (pydoc numpy.random) and changelogs.