code: def getran(self, ndigits):
      self.assertGreater(ndigits, 0)
      nbits_hi = ndigits * SHIFT
      nbits_lo = nbits_hi - SHIFT + 1
      answer = 0
      nbits = 0
      r = (
          int(random.random() * (SHIFT * 2)) | 1
      )  # force 1 bits to start
      while nbits < nbits_lo:
          bits = (r >> 1) + 1
          bits = min(bits, nbits_hi - nbits)
          self.assertTrue(1 <= bits <= SHIFT)
          nbits = nbits + bits
          answer = answer << bits
          if r & 1:
              answer = answer | ((1 << bits) - 1)
          r = int(random.random() * (SHIFT * 2))
      self.assertTrue(nbits_lo <= nbits <= nbits_hi)
      if random.random() < 0.5:
          answer = -answer
      return answer
  
imports: import unittest
  from test import support
  import sys
  import random
  import math
  import array
label_desc: Use image node_id 1 for calling the LongTest obj's underlying member method code with example usage: obj.getran(ndigits) and returns: answer