randomizeSlopeValue (random, setting) {
    const alphabetSetting = this.getSetting('alphabet')
    if (alphabetSetting.isValid()) {
      const alphabet = alphabetSetting.getValue()
      const m = alphabet.getLength()

      // Create range based on alphabet and filter coprime values
      // Don't use caesar cipher slope (a=1) if possible
      const range = alphabet.getCodePoints().map((_, i) => i + 1)
      const coprimes = range.filter(a => a > 1 && MathUtil.isCoprime(a, m))
      return coprimes.length > 0 ? random.nextChoice(coprimes) : 1
    }
    return null
  }
/**
   * Generates a random slope setting value.
   * @protected
   * @param {Random} random Random instance
   * @param {Setting} setting Setting instance
   * @return {string} Random slope setting value
   */
Generates a random slope setting value.
@protected
@param {Random} random Random instance
@param {Setting} setting Setting instance
@return {string} Random slope setting value
Generates a random slope setting value . @protected @param { Random } random Random instance @param { Setting } setting Setting instance @return { string } Random slope setting value
randomizeSlopeValue (random, setting) {
    const alphabetSetting = this.getSetting('alphabet')
    if (alphabetSetting.isValid()) {
      const alphabet = alphabetSetting.getValue()
      const m = alphabet.getLength()
      const range = alphabet.getCodePoints().map((_, i) => i + 1)
      const coprimes = range.filter(a => a > 1 && MathUtil.isCoprime(a, m))
      return coprimes.length > 0 ? random.nextChoice(coprimes) : 1
    }
    return null
  }
randomizeSlopeValue ( random , setting ) { const alphabetSetting = this . getSetting ( 'alphabet' ) if ( alphabetSetting . isValid ( ) ) { const alphabet = alphabetSetting . getValue ( ) const m = alphabet . getLength ( ) const range = alphabet . getCodePoints ( ) . map ( ( _ , i ) => i + 1 ) const coprimes = range . filter ( a => a > 1 && MathUtil . isCoprime ( a , m ) ) return coprimes . length > 0 ? random . nextChoice ( coprimes ) : 1 } return null }
Generates a random slope setting value.
Generates a random slope setting value .
// Create range based on alphabet and filter coprime values // Don't use caesar cipher slope (a=1) if possible