code: def test_cpu_randomstate():
      # run 1
      be = gen_backend(backend="cpu", rng_seed=100)
  
      a = be.empty((3, 3))
      be.make_binary_mask(a, keepthresh=be.rng.rand())
      x0 = a.get()
      be.make_binary_mask(a, keepthresh=be.rng.rand())
      x1 = a.get()
  
      # run 2, using reset
      be.rng_reset()
      be.make_binary_mask(a, keepthresh=be.rng.rand())
      y0 = a.get()
      be.make_binary_mask(a, keepthresh=be.rng.rand())
      y1 = a.get()
  
      del be
  
      # run 3, using a new backend
      be = gen_backend(backend="cpu", rng_seed=100)
  
      a = be.empty((3, 3))
      be.make_binary_mask(a, keepthresh=be.rng.rand())
      z0 = a.get()
      be.make_binary_mask(a, keepthresh=be.rng.rand())
      z1 = a.get()
  
      # check equality
      assert tensors_allclose([x0, x1], [y0, y1], rtol=0.0, atol=0.0)
      assert tensors_allclose([x0, x1], [z0, z1], rtol=0.0, atol=0.0)
      del be
  
file_path: neon/tests/test_backend_randomstate.py
imports: import numpy
  import pytest
  from neon.backends import gen_backend
  from utils import tensors_allclose
label_desc: Use image node_id 2 for calling a global function with example usage: test_cpu_randomstate() without return types