class_docstr: QMC sampling from a multinomial distribution.
  
  Parameters
  ----------
  pvals : array_like (k,)
      Vector of probabilities of size ``k``, where ``k`` is the number
      of categories. Elements must be non-negative and sum to 1.
  engine : QMCEngine, optional
      Quasi-Monte Carlo engine sampler. If None, `Sobol` is used.
  seed : {None, int, `numpy.random.Generator`}, optional
      If `seed` is None the `numpy.random.Generator` singleton is used.
      If `seed` is an int, a new ``Generator`` instance is used,
      seeded with `seed`.
      If `seed` is already a ``Generator`` instance then that instance is
      used.
  
  Examples
  --------
  >>> from scipy.stats import qmc
  >>> engine = qmc.MultinomialQMC(pvals=[0.2, 0.4, 0.4])
  >>> sample = engine.random(10)
class_docstr_tok: ["QMC","sampling","from","a","multinomial","distribution",".","Parameters","--","--","--","--","--","pvals",":","array_like","(","k",",",")","Vector","of","probabilities","of","size","``","k","``",",","where","``","k","``","is","the","number","of","categories",".","Elements","must","be","non-negative","and","sum","to","1.","engine",":","QMCEngine",",","optional","Quasi-Monte","Carlo","engine","sampler",".","If","None",",","`","Sobol","`","is","used",".","seed",":","{","None",",","int",",","`","numpy.random.Generator","`","}",",","optional","If","`","seed","`","is","None","the","`","numpy.random.Generator","`","singleton","is","used",".","If","`","seed","`","is","an","int",",","a","new","``","Generator","``","instance","is","used",",","seeded","with","`","seed","`",".","If","`","seed","`","is","already","a","``","Generator","``","instance","then","that","instance","is","used",".","Examples","--","--","--","--",">",">",">","from","scipy.stats","import","qmc",">",">",">","engine","=","qmc.MultinomialQMC","(","pvals=","[","0.2",",","0.4",",","0.4","]",")",">",">",">","sample","=","engine.random","(","10",")"]
code: def __init__(
      self,
      pvals: npt.ArrayLike,
      *,
      engine: Optional[QMCEngine] = None,
      seed: SeedType = None,
  ) -> None:
      self.pvals = np.array(pvals, copy=False, ndmin=1)
      if np.min(pvals) < 0:
          raise ValueError("Elements of pvals must be non-negative.")
      if not np.isclose(np.sum(pvals), 1):
          raise ValueError("Elements of pvals must sum to 1.")
      if engine is None:
          self.engine = Sobol(
              d=1, scramble=True, seed=seed
          )  # type: QMCEngine
      elif isinstance(engine, QMCEngine):
          if engine.d != 1:
              raise ValueError("Dimension of `engine` must be 1.")
          self.engine = engine
      else:
          raise ValueError(
              "`engine` must be an instance of "
              "`scipy.stats.qmc.QMCEngine` or `None`."
          )
  
      super().__init__(d=1, seed=seed)
  
imports: from __future__ import annotations
  import os
  import copy
  import numbers
  from abc import ABC, abstractmethod
  import math
  from typing import ClassVar, List, Optional, overload, TYPE_CHECKING
  import warnings
  import numpy
  import scipy.stats
  from scipy._lib._util import rng_integers
  from scipy.stats._sobol import initialize_v, _cscramble, _fill_p_cumulative, _draw, _fast_forward, _categorize, initialize_direction_numbers, _MAXDIM, _MAXBIT
  from scipy.stats._qmc_cy import _cy_wrapper_centered_discrepancy, _cy_wrapper_wrap_around_discrepancy, _cy_wrapper_mixture_discrepancy, _cy_wrapper_l2_star_discrepancy, _cy_wrapper_update_discrepancy
label_desc: Use image node_id 1 to create a new MultinomialQMC object from inherited base classes: QMCEngine with example: obj = MultinomialQMC(pvals)