code: def _random_condition(shape, dtype, *, random_state=None):
      if random_state is None:
          random_state = numpy.random.RandomState()
      neg_mask = random_state.randint(0, 2, size=shape).astype("bool")
      cond = array_utils.uniform(
          shape, dtype, random_state=random_state
      )
      # Replace zeros with nonzero, making the average number of zero elements
      # in cond independent of the dtype.
      cond[cond == 0] = 1
      cond[neg_mask] = 0
      return cond
  
imports: import unittest
  import numpy
  import pytest
  import chainer.testing
  import chainerx
  import chainerx.testing
  from chainerx_tests import array_utils
  from chainerx_tests import dtype_utils
  from chainerx_tests import math_utils
  from chainerx_tests import op_utils
label_desc: Use image node_id 4 for calling a global function with example usage: _random_condition(shape, dtype) and returns: cond