code: def check_uniform_default(
      device="cpu", batch_size=32, shape=[1e5], val_range=None, niter=3
  ):
      pipe = Pipeline(
          batch_size=batch_size, device_id=0, num_threads=3, seed=123456
      )
      with pipe:
          pipe.set_outputs(
              dali.fn.random.uniform(
                  device=device, range=val_range, shape=shape
              )
          )
      pipe.build()
      for it in range(niter):
          outputs = pipe.run()
          val_range = (-1.0, 1.0) if val_range is None else val_range
          data_out = (
              outputs[0].as_cpu()
              if isinstance(outputs[0], TensorListGPU)
              else outputs[0]
          )
          pvs = []
          for i in range(batch_size):
              data = np.array(data_out[i])
              # Check that the data is within the default range
              assert (data >= val_range[0]).all() and (
                  data <= val_range[1]
              ).all(), "Value returned from the op is outside of requested range"
  
              h, b = np.histogram(data, bins=10)
              mean_h = np.mean(h)
              for hval in h:
                  np.testing.assert_allclose(
                      mean_h, hval, rtol=0.05
                  )  # +/- 5%
  
              # normalize to 0-1 range
              data_kstest = (data - val_range[0]) / (
                  val_range[1] - val_range[0]
              )
              _, pv = st.kstest(rvs=data_kstest, cdf="uniform")
              pvs = pvs + [pv]
          assert (
              np.mean(pvs) > 0.05
          ), f"data is not a uniform distribution. pv = {np.mean(pvs)}"
  
file_path: DALI/dali/test/python/operator_2/test_uniform.py
imports: import nvidia.dali
  from nvidia.dali.pipeline import Pipeline
  from nvidia.dali.backend_impl import TensorListGPU
  import numpy
  import scipy.stats
label_desc: Use image node_id 1 for calling a global function with example usage: check_uniform_default(device, batch_size, shape, val_range, niter) without return types