code: def check_distribution_rvs(dist, args, alpha, rvs):
      # dist is either a cdf function or name of a distribution in scipy.stats.
      # args are the args for scipy.stats.dist(*args)
      # alpha is a significance level, ~0.01
      # rvs is array_like of random variables
      # test from scipy.stats.tests
      # this version reuses existing random variables
      D, pval = stats.kstest(rvs, dist, args=args, N=1000)
      if pval < alpha:
          # The rvs passed in failed the K-S test, which _could_ happen
          # but is unlikely if alpha is small enough.
          # Repeat the test with a new sample of rvs.
          # Generate 1000 rvs, perform a K-S test that the new sample of rvs
          # are distributed according to the distribution.
          D, pval = stats.kstest(dist, dist, args=args, N=1000)
          npt.assert_(
              pval > alpha,
              "D = "
              + str(D)
              + "; pval = "
              + str(pval)
              + "; alpha = "
              + str(alpha)
              + "\nargs = "
              + str(args),
          )
  
imports: import sys
  import numpy
  import numpy.testing
  import pytest
  from pytest import raises
  from scipy.integrate import IntegrationWarning
  import itertools
  from scipy import stats
  from .common_tests import check_normalization, check_moment, check_mean_expect, check_var_expect, check_skew_expect, check_kurt_expect, check_entropy, check_private_entropy, check_entropy_vect_scale, check_edge_support, check_named_args, check_random_state_property, check_meth_dtype, check_ppf_dtype, check_cmplx_deriv, check_pickling, check_rvs_broadcast, check_freezing, check_munp_expect
  from scipy.stats._distr_params import distcont
  from scipy.stats._distn_infrastructure import rv_continuous_frozen
label_desc: Use image node_id 29 for calling a global function with example usage: check_distribution_rvs(dist, args, alpha, rvs) without return types