code: def test_random():
      for i in range(100):
          ndim = 1 + i
          start = np.random.uniform(size=ndim)
          direction = np.random.normal(size=ndim)
          direction /= (direction**2).sum() ** 0.5
  
          reset = np.random.binomial(1, 0.1, size=ndim) == 1
          direction[reset] = -start[reset]
          # check that the returned result is symmetric to the direction
          (c1, _, ax1), (c2, _, ax2) = box_line_intersection(
              start, direction
          )
          (b1, _, ax1), (b2, _, ax2) = box_line_intersection(
              start, -direction
          )
          np.testing.assert_allclose(c1, b2)
          np.testing.assert_allclose(b1, c2)
  
          # check that the i+j step is consistent with making i steps and then j steps
          wrapped_dims = np.random.binomial(0.5, 1, size=ndim).astype(
              bool
          )
          a, b = linear_steps_with_reflection(
              start, direction, 1 * 0.04, wrapped_dims=wrapped_dims
          )
          c, d = linear_steps_with_reflection(
              a, b, 1 * 0.04, wrapped_dims=wrapped_dims
          )
          e, f = linear_steps_with_reflection(
              start, direction, 2 * 0.04, wrapped_dims=wrapped_dims
          )
  
          # check that the length is not infinite
          wrapped_dims = np.ones(ndim, dtype=bool)
          a, b = linear_steps_with_reflection(
              start, direction, 1000000, wrapped_dims=wrapped_dims
          )
  
file_path: ultranest/tests/test_samplingpath.py
imports: import numpy
  import matplotlib.pyplot
  from ultranest.mlfriends import AffineLayer, MLFriends
  from ultranest.samplingpath import SamplingPath, ContourSamplingPath
  from ultranest.samplingpath import box_line_intersection, nearest_box_intersection_line, linear_steps_with_reflection, angle, get_sphere_tangents, norm
  from numpy.testing import assert_allclose
label_desc: Use image node_id 4 for calling a global function with example usage: test_random() without return types