Skip to content

The Recommended Random Number Generation In NumPy #19670

Closed

Description

@ArnuldOnData

Problem

Matplotlib documentation still uses old method of random number generation in NumPy. I think we can update the code to use newer method. Newer method was intropduced in NumPy 1.17 and recommended by NumPy over the older method (even though the older method still works)

Suggested Improvement

  • We can change the code to shown in this GitHub gist
  • Entire documenation regarding recommended method is in NumPy docs
  • Here is a visualization/output from the code in gist above:

matplotlib-numpy-random

Matplotlib version

  • Operating system: Arch Linux
  • Matplotlib version: 3.3.4 (matplotlib.version)
  • Python version: 3.9.2 (platform.python_version())
  • Matplotlib documentation version: Doc version v3.3.4 (as seen at the bottom of the histogram page )

Activity

  1. added
    🌱 Good first issueOpen a pull request against these issues if there are no active ones!
    on Mar 9, 2021
  2. ria-19 commented on Mar 9, 2021

    @ria-19

    Hi, I am a beginner in the open-source world, can I work on this issue?

  3. jklymak commented on Mar 9, 2021

    @jklymak
    Member

    Anyone can work on an issue if there is no existing PR. If there is a PR it's nice to ask the author first.

  4. ria-19 commented on Mar 9, 2021

    @ria-19

    Okay, thank you.

  5. rajpratyush commented on Mar 14, 2021

    @rajpratyush
    Contributor

    @jklymak Can you tell me where the file to be changed are located?

  6. story645 commented on Mar 14, 2021

    @story645
    Member

    @rajpratyush unless someone happens to know off hand, it'll take them about as long to dig into the docs to find it as it would take you. One method though of finding the right file is running 'git grep' on your local version of the repo w/ some words that are specific to the example.

  7. ArnuldOnData commented on Mar 14, 2021

    @ArnuldOnData
    Author
  8. rajpratyush commented on Mar 14, 2021

    @rajpratyush
    Contributor

    Sure @story645 Lemme look for it. Thanks for assistance

  9. tacaswell commented on Mar 18, 2021

    @tacaswell
    Member

    As discussed in #19706 , we have decided to not change all of the use of random number generators in our examples. Thank you for the suggestion @ArnuldOnData , but we are going to close this with no action.

    It may be reasonable to re-consider this is a few years when pre 1.17 versions of numpy are few and far between or if numpy starts actively warning when the old API is used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Documentation🌱 Good first issueOpen a pull request against these issues if there are no active ones!

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions