#26301·scipy

DEP: stats: `stats.sampling.FastGeneratorInversion.qrvs` default QMC Engine needs to change

Author: mdhaberCreated Sep 28, 2026Updated Sep 28, 2026
Labelsscipy.statsdeprecated

When no qmc_engine is provided, FastGeneratorInversion.qrvs instantates Halton with kwarg seed set to self.random_state.

https://github.com/scipy/scipy/blob/54ef5423f2e4376230ec3bfda6912a07a50958e3/scipy/stats/_sampling.py#L402-L404

gh-26277 is activating SPEC 7 deprecation messages, which will cause Halton to complain about use of kwarg seed. So something needs to happen before Halton stops accepting the seed argument.

We could silence the messages, but at some point, Halton will stop accepting seed.

We could update the call to rng and document the backward-incompatible change, but we might not want to. This would change the behavior of qrvs unless self.random_state is already a Generator:

  • if self.random_state is None, the random state would change from being controlled by global random state to being nondeterministic
  • if self.random_state is an int, the random state would change from RandomState seed with the int to a Generator seeded with the int.
  • if self.random_state is an instance of RandomState, Halton would start raising due to gh-26291.

However, this might be OK in a major release. I'm not immediately finding uses of FastGeneratorInversion.qrvs without a qmc_engine on GH, and neither does ChatGPT. In fact, "I cannot find a single genuine downstream use of FastGeneratorInversion.qrvs on GitHub at all".

We could add the _transition_to_rng decorator to FastGeneratorInversion to deprecate use of the random_state argument now. This would force users to change the random_state input to a Generator to avoid warnings. We could simply silence warnings produced by the internal use of Halton with kwarg seed until all the deprecations expire. At that point, FastGeneratorInversion would standardize all rng arguments with default_rng, and these could be passed to Halton using the rng argument. The problem is that FastGeneratorInversion doesn't have an rng argument at this time, and it was decided that we can't start warning until there are at least 2 years of ScIPy versions that accept an rng argument.

One option is to have FastGeneratorInversion emit FutureWarnings if the random_state argument is not already a Generator. I don't see any downsides; it just might be unnecessary if there aren't any real uses of FastGeneratorInversion.