public static BigInteger [ ] generateRandomCoefficients ( int n , BigInteger elementZero , BigInteger prime ) { BigInteger [ ] res = new BigInteger [ n ] ; res [ 0 ] = elementZero ; for ( int i = 1 ; i < n ; i ++ ) { res [ i ] = SasUtils . generateRandomIntegerLessThan ( prime ) ; } return res ; }
Generate random coefficients for the Shamir s Secret Sharing algorithm . First coefficient is filled with a known value and the rest of the coefficients are randomly generated keeping them less than the specified prime .