Skip to content

//core/io.github.serpro69.kfaker/IRandom

IRandom

interface IRandom

Provides functionality similar to Random

Inheritors

RandomService
RandomProvider

Properties

Name Summary
config [jvm]
abstract val config: FakerConfig

Functions

Name Summary
nextBoolean [jvm]
abstract fun nextBoolean(): Boolean
Returns the next pseudorandom, uniformly distributed Boolean value from this random number generator's sequence.
nextChar [jvm]
abstract fun nextChar(): Char
Returns the next pseudorandom, uniformly distributed Char value, from this random number generator's sequence.
nextDouble [jvm]
abstract fun nextDouble(): Double
Returns the next pseudorandom, uniformly distributed Double value between 0.0 and 1.0 from this random number generator's sequence.
nextEnum [jvm]
abstract fun <E : Enum<E>> nextEnum(enum: Class<E>): E
Returns a pseudo-randomly selected enum entry of type E.
[jvm]
abstract fun <E : Enum<E>> nextEnum(values: Array<E>): E
Returns a pseudo-randomly selected enum entry from an Array of E type values.
[jvm]
abstract fun <E : Enum<E>> nextEnum(enum: Class<E>, predicate: (E) -> Boolean): E
Returns a pseudo-randomly selected enum class of type E based on predicate for E.
nextFloat [jvm]
abstract fun nextFloat(): Float
Returns the next pseudorandom, uniformly distributed Float value between 0.0 and 1.0 from this random number generator's sequence.
nextInt [jvm]
abstract fun nextInt(): Int
Returns the next pseudorandom, uniformly distributed Int value from this random number generator's sequence.
[jvm]
abstract fun nextInt(bound: Int): Int
Returns a pseudorandom, uniformly distributed Int value between 0 (inclusive) and the specified bound (exclusive), drawn from this random number generator's sequence.
[jvm]
abstract fun nextInt(intRange: IntRange): Int
Returns a pseudorandom, uniformly distributed Int value within the specified int range (inclusive), drawn from this random number generator's sequence.
[jvm]
abstract fun nextInt(min: Int, max: Int): Int
Returns a pseudorandom, uniformly distributed Int value between min (inclusive) and max (inclusive), drawn from this random number generator's sequence.
nextLetter [jvm]
abstract fun nextLetter(upper: Boolean): Char
Returns the next pseudorandom, uniformly distributed Char value that corresponds to a letter in the English alphabet.
nextLong [jvm]
abstract fun nextLong(): Long
Returns the next pseudorandom, uniformly distributed Long value from this random number generator's sequence.
[jvm]
abstract fun nextLong(bound: Long): Long
Returns a pseudorandom, uniformly distributed Long value between 0 (inclusive), and the specified bound value (exclusive), drawn from this random number generator's sequence.
[jvm]
abstract fun nextLong(longRange: LongRange): Long
Returns a pseudorandom, uniformly distributed Long value within the specified longRange (inclusive), drawn from this random number generator's sequence.
[jvm]
abstract fun nextLong(min: Long, max: Long): Long
Returns a pseudorandom, uniformly distributed Long value between min (inclusive) and max (inclusive), drawn from this random number generator's sequence.
nextUUID [jvm]
abstract fun nextUUID(): String
Returns the next pseudorandom UUID as String taking the seed of this random.
randomDate [jvm]
abstract fun randomDate(min: Instant, max: Instant, zoneOffset: ZoneOffset): OffsetDateTime
Returns a pseudorandom, uniformly distributed OffsetDateTime value between min (inclusive) and max (inclusive) using the defined zoneOffset
randomFutureDate [jvm]
abstract fun randomFutureDate(): OffsetDateTime
Returns a pseudorandom, uniformly distributed OffsetDateTime value between now (exclusive) and now + 50 years (inclusive) using UTC zone offset
[jvm]
abstract fun randomFutureDate(max: Instant): OffsetDateTime
Returns a pseudorandom, uniformly distributed OffsetDateTime value between now (exclusive) and max (inclusive) using UTC zone offset
randomPastDate [jvm]
abstract fun randomPastDate(): OffsetDateTime
Returns a pseudorandom, uniformly distributed OffsetDateTime value between Unix epoch (1970-01-01T00:00:00Z) (inclusive) and now (exclusive) using UTC zone offset
[jvm]
abstract fun randomPastDate(min: Instant): OffsetDateTime
Returns a pseudorandom, uniformly distributed OffsetDateTime value between min (inclusive) and now (exclusive) using UTC zone offset
randomString [jvm]
abstract fun randomString(length: Int = 24, numericalChars: Boolean = true): String
Returns String with the specified length consisting of a pseudo-randomly generated English alphabet letters and optional numericalChars, or an empty string for a length < 1.
[jvm]
abstract fun randomString(length: Int = 24, locale: Locale = Locale.forLanguageTag(config.locale), indexChars: Boolean = true, auxiliaryChars: Boolean = false, punctuationChars: Boolean = false, numericalChars: Boolean = false): String
Returns String with the specified length (or an empty string for a length < 1) consisting of pseudo-randomly generated characters in a given locale with optional auxiliaryChars and numericalChars
[jvm]
abstract fun randomString(min: Int, max: Int, locale: Locale = Locale.forLanguageTag(config.locale), indexChars: Boolean = true, auxiliaryChars: Boolean = false, punctuationChars: Boolean = false, numericalChars: Boolean = false): String
Returns String with a randomLength withing the specified min and max boundaries (or an empty string for if randomLength < 1) consisting of pseudo-randomly generated characters in a given locale with optional auxiliaryChars and numericalChars
randomSublist [jvm]
abstract fun <T> randomSublist(list: List<T>, size: Int = 0, shuffled: Boolean = false): List<T>
abstract fun <T> randomSublist(list: List<T>, sizeRange: IntRange, shuffled: Boolean = false): List<T>
Returns a view of the portion of the list with pseudo-randomly generated fromIndex and (possibly) toIndex values.
randomSubset [jvm]
abstract fun <T> randomSubset(set: Set<T>, size: Int = 0, shuffled: Boolean = false): Set<T>
abstract fun <T> randomSubset(set: Set<T>, sizeRange: IntRange, shuffled: Boolean = false): Set<T>
Returns a portion of the set with pseudo-randomly generated fromIndex and (possibly) toIndex values.
randomValue [jvm]
abstract fun <T> randomValue(array: Array<T>): T
Returns a pseudo-randomly selected value from the array of values.
[jvm]
abstract fun <T> randomValue(list: List<T>): T
Returns a pseudo-randomly selected value from the list of values.