Infendro 2ae6fda70e
All checks were successful
/ test (pull_request) Successful in 38s
implement xoshiro256++ and xoshiro256**
2026-01-30 15:16:48 +01:00
2026-01-30 13:43:33 +01:00
2026-01-30 13:41:43 +01:00
2025-07-24 20:49:21 +02:00
2026-01-30 13:41:43 +01:00
2025-08-16 21:27:07 +02:00
2025-08-16 21:27:07 +02:00
2025-07-24 20:49:21 +02:00
2026-01-30 13:41:43 +01:00
2025-12-13 01:19:11 +01:00

prng-kt

prng-kt is a Kotlin Multiplatform library that provides common Pseudorandom Number Generators.

Supported PRNG algorithms:

  • LCG

Supported CSPRNG algorithms:

  • HMAC-DRBG

Installation

Add the following to your build.gradle.kts.

repositories {
    maven("https://git.infendro.com/api/packages/Infendro/maven")
}

dependencies {
    implementation("com.infendro:prng:1.3.0")
}

Usage

fun main() {
    // create PRNG instance
    val rng = CSPRNG.HMAC(`SHA-256`)

    // seed PRNG to receive deterministic numbers
    rng.seed(/* seed */)
    val a = rng.nextInt()
    val b = rng.nextInt()
    val c = rng.nextInt()

    // reseed PRNG to add additional entropy
    rng.reseed(/* entropy */)
    val d = rng.nextInt()
    val e = rng.nextInt()
    val f = rng.nextInt()

    // a, b, and c will be deterministic
    // d, e, and f will be random (assuming entropy is random)
}
Description
No description provided
Readme 170 KiB
Languages
Kotlin 100%