def i_to_s(input)
      if !input.is_a?(Integer) || input < 0
        fail NotPositiveInteger, "input must be a non-negative integer"
      end

      output = ""
      while input > 0
        input, codepoint = input.divmod(charset.length)
        output.prepend(codepoint_to_char(codepoint))
      end
      output
    end
def i_to_s(input)
      if !input.is_a?(Integer) || input < 0
        fail NotPositiveInteger, "input must be a non-negative integer"
      end

      output = ""
      while input > 0
        input, codepoint = input.divmod(charset.length)
        output.prepend(codepoint_to_char(codepoint))
      end
      output
    end
The "null-byte" character is prepended to be the first character in the
 charset to avoid loosing the first character of the charset when it is
 also the first character in a string to convert.

 Example

   SecretSharing::Charset::DynamicCharset.new ["a", "b", "c"] # =>
   #<SecretSharing::Charset::DynamicCharset @charset=[...]>

 @param charset [Array] array of characters to use for the charset.
 Calculate a string from an integer.

 Example

   charset = SecretSharing::Charset.by_charset_string "abc"
   charset.i_to_s 6
   # => "ab"

 @param input [Integer] integer to convert to string
 @return [String] converted string