MCPcopy Create free account
hub / github.com/cryptii/cryptii / randomizeShiftValue

Method randomizeShiftValue

src/Encoder/CaesarCipher.js:166–172  ·  view source on GitHub ↗

* Generates a random shift setting value. * @param {Random} random Random instance * @param {Field} setting Shift setting * @return {string} Randomized plugboard setting value

(random, setting)

Source from the content-addressed store, hash-verified

164 * @return {string} Randomized plugboard setting value
165 */
166 randomizeShiftValue (random, setting) {
167 const alphabetSetting = this.getSetting('alphabet')
168 if (alphabetSetting.isValid()) {
169 return random.nextInteger(1, alphabetSetting.getValue().getLength() - 1)
170 }
171 return null
172 }
173
174 /**
175 * Function describing the given shift value in a human-readable way.

Callers

nothing calls this directly

Calls 5

getSettingMethod · 0.80
nextIntegerMethod · 0.80
isValidMethod · 0.45
getLengthMethod · 0.45
getValueMethod · 0.45

Tested by

no test coverage detected