code: def random_number_lower_endian(length, base):
    
    if length == 1:  # Last digit can be 0 only if length is 1.
      return [np.random.randint(base)]
    prefix = [np.random.randint(base) for _ in range(length - 1)]
    return prefix + [np.random.randint(base - 1) + 1]
docs: Helper function: generate a random number as a lower-endian digits list.