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

Method randomize

src/Field.js:307–316  ·  view source on GitHub ↗

* Applies a randomly chosen value. * Uses Field.randomizeValue internally. * Does nothing when randomizable is set to false. * @param {Random} [random] Random number generator * @return {Field} Fluent interface

(random = null)

Source from the content-addressed store, hash-verified

305 * @return {Field} Fluent interface
306 */
307 randomize (random = null) {
308 if (!this.isRandomizable()) {
309 return this
310 }
311 const value = this.randomizeValue(random || new Random())
312 if (value !== null) {
313 return this.setValue(value)
314 }
315 return this
316 }
317
318 /**
319 * Returns a randomly chosen value or `null` if not applicable.

Callers

nothing calls this directly

Calls 3

isRandomizableMethod · 0.95
randomizeValueMethod · 0.95
setValueMethod · 0.95

Tested by

no test coverage detected