ofCodeUnitsLength

open override fun ofCodeUnitsLength(r: Random, minCodeUnits: Int, maxCodeUnits: Int): String

Return

Returns a string of variable length between minCodeUnits (inclusive) and maxCodeUnits (inclusive) length. Code units are essentially an equivalent of char type, see String class for explanation.

Parameters

minCodeUnits

Minimum number of code units (inclusive).

maxCodeUnits

Maximum number of code units (inclusive).

Throws

Thrown if the generator cannot emit random string of the given unit length. For example a generator emitting only extended unicode plane characters (encoded as surrogate pairs) will not be able to emit an odd number of code units.