lib/secret_sharing/polynomial.rb
def points(num_points, prime)
      intercept = @coefficients[0] # the first coefficient is the intercept
      (1..num_points).map do |x|
        y = intercept
        (1...@coefficients.length).each do |i|
          y = (y + @coefficients[i] * x ** i) % prime
        end
        Point.new(x, y)
      end
    end
def points(num_points, prime)
      intercept = @coefficients[0] # the first coefficient is the intercept
      (1..num_points).map do |x|
        y = intercept
        (1...@coefficients.length).each do |i|
          y = (y + @coefficients[i] * x ** i) % prime
        end
        Point.new(x, y)
      end
    end
Create a new instance of a Polynomial with n coefficients, when having
 the polynomial in standard polynomial form.

 Example

   For the polynomial f(x) = a0 + a1 * x + a2 * x^2 + ... + an * x^n the
   coefficients are [a0, a1, a2, ..., an]

   Polynomial.new [1, 2, 3]
   # => #<SecretSharing::Polynomial:0x0000000 @coefficients=[1, 2, 3]>

 @param coefficients [Array] an array of integers as the coefficients
 Generate points on the polynomial, that can be used to reconstruct the
 polynomial with.

 Example

   SecretSharing::Polynomial.new([1, 2, 3, 4]).points(3, 7)
   # => [#<Point: @x=1 @y=3>, #<Point: @x=2 @y=0>, #<Point: @x=3 @y=2>]

 @param num_points [Integer] number of points to generate
 @param prime [Integer] prime for calculation in finite field
 @return [Array] array of calculated points