{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {},
  "_ordered_sections": [],
  "item_file": null,
  "item_line": null,
  "item_type": null,
  "aliases": [],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": null,
  "references": null,
  "qa": "reference:random:generator",
  "arbitrary": [
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "Generator",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " provides access to a wide range of distributions, and served as a replacement for "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "RandomState",
              "reference": {
                "__type": "RefInfo",
                "__tag": 4000,
                "module": "numpy",
                "version": "*",
                "kind": "api",
                "path": "numpy.random.mtrand:RandomState"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ".  The main difference between the two is that "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "Generator",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " relies on an additional BitGenerator to manage state and generate the random bits, which are then transformed into random values from useful distributions. The default BitGenerator used by "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "Generator",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "PCG64",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ".  The BitGenerator can be changed by passing an instantized BitGenerator to "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "Generator",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Random "
        },
        {
          "__type": "InlineCode",
          "__tag": 4051,
          "value": "Generator"
        }
      ],
      "level": 0,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Code",
          "__tag": 4050,
          "value": ".. autosummary:: \n    :toctree:generated/\n    ~numpy.random.Generator.bit_generator\n    ~numpy.random.Generator.spawn",
          "execution_status": null
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Accessing the BitGenerator and spawning"
        }
      ],
      "level": 1,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Code",
          "__tag": 4050,
          "value": ".. autosummary:: \n    :toctree:generated/\n    ~numpy.random.Generator.integers\n    ~numpy.random.Generator.random\n    ~numpy.random.Generator.choice\n    ~numpy.random.Generator.bytes",
          "execution_status": null
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Simple random data"
        }
      ],
      "level": 1,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The methods for randomly permuting a sequence are"
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": ".. autosummary:: \n    :toctree:generated/\n    ~numpy.random.Generator.shuffle\n    ~numpy.random.Generator.permutation\n    ~numpy.random.Generator.permuted",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The following table summarizes the behaviors of the methods."
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "+--------------+-------------------+------------------+\n| method       | copy/in-place     | axis handling    |\n+==============+===================+==================+\n| shuffle      | in-place          | as if 1d         |\n+--------------+-------------------+------------------+\n| permutation  | copy              | as if 1d         |\n+--------------+-------------------+------------------+\n| permuted     | either (use 'out' | axis independent |\n|              | for in-place)     |                  |\n+--------------+-------------------+------------------+",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The following subsections provide more details about the differences."
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Permutations"
        }
      ],
      "level": 1,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The main difference between "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "Generator.shuffle",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "Generator.permutation",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is that "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "Generator.shuffle",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " operates in-place, while "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "Generator.permutation",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " returns a copy."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "By default, "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "Generator.permuted",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " returns a copy.  To operate in-place with "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "Generator.permuted",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", pass the same array as the first argument "
            },
            {
              "__type": "Emphasis",
              "__tag": 4047,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "and"
                }
              ]
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " as the value of the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "out"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " parameter.  For example,"
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "In-place vs. copy"
        }
      ],
      "level": 2,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "An important distinction for these methods is how they handle the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "axis"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " parameter.  Both "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "Generator.shuffle",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "Generator.permutation",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " treat the input as a one-dimensional sequence, and the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "axis"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " parameter determines which dimension of the input array to use as the sequence. In the case of a two-dimensional array, "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "axis=0"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " will, in effect, rearrange the rows of the array, and  "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "axis=1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " will rearrange the columns.  For example"
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Note that the columns have been rearranged \"in bulk\": the values within each column have not changed."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The method "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "Generator.permuted",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " treats the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "axis"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " parameter similar to how "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "numpy.sort",
              "reference": {
                "__type": "RefInfo",
                "__tag": 4000,
                "module": "numpy",
                "version": "*",
                "kind": "api",
                "path": "numpy:sort"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " treats it.  Each slice along the given axis is shuffled independently of the others.  Compare the following example of the use of "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "Generator.permuted",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " to the above example of "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "Generator.permutation",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ":"
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "In this example, the values within each row (i.e. the values along "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "axis=1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ") have been shuffled independently.  This is not a \"bulk\" shuffle of the columns."
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Handling the "
        },
        {
          "__type": "InlineCode",
          "__tag": 4051,
          "value": "axis"
        },
        {
          "__type": "Text",
          "__tag": 4046,
          "value": " parameter"
        }
      ],
      "level": 2,
      "target": "generator-handling-axis-parameter"
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "Generator.shuffle",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " works on non-NumPy sequences.  That is, if it is given a sequence that is not a NumPy array, it shuffles that sequence in-place."
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Shuffling non-NumPy sequences"
        }
      ],
      "level": 2,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Code",
          "__tag": 4050,
          "value": ".. autosummary:: \n    :toctree:generated/\n    ~numpy.random.Generator.beta\n    ~numpy.random.Generator.binomial\n    ~numpy.random.Generator.chisquare\n    ~numpy.random.Generator.dirichlet\n    ~numpy.random.Generator.exponential\n    ~numpy.random.Generator.f\n    ~numpy.random.Generator.gamma\n    ~numpy.random.Generator.geometric\n    ~numpy.random.Generator.gumbel\n    ~numpy.random.Generator.hypergeometric\n    ~numpy.random.Generator.laplace\n    ~numpy.random.Generator.logistic\n    ~numpy.random.Generator.lognormal\n    ~numpy.random.Generator.logseries\n    ~numpy.random.Generator.multinomial\n    ~numpy.random.Generator.multivariate_hypergeometric\n    ~numpy.random.Generator.multivariate_normal\n    ~numpy.random.Generator.negative_binomial\n    ~numpy.random.Generator.noncentral_chisquare\n    ~numpy.random.Generator.noncentral_f\n    ~numpy.random.Generator.normal\n    ~numpy.random.Generator.pareto\n    ~numpy.random.Generator.poisson\n    ~numpy.random.Generator.power\n    ~numpy.random.Generator.rayleigh\n    ~numpy.random.Generator.standard_cauchy\n    ~numpy.random.Generator.standard_exponential\n    ~numpy.random.Generator.standard_gamma\n    ~numpy.random.Generator.standard_normal\n    ~numpy.random.Generator.standard_t\n    ~numpy.random.Generator.triangular\n    ~numpy.random.Generator.uniform\n    ~numpy.random.Generator.vonmises\n    ~numpy.random.Generator.wald\n    ~numpy.random.Generator.weibull\n    ~numpy.random.Generator.zipf",
          "execution_status": null
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Distributions"
        }
      ],
      "level": 1,
      "target": null
    }
  ],
  "local_refs": []
}