All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.ru.casperix.math.random.RandomFloat.kt Maven / Gradle / Ivy

package ru.casperix.math.random

import kotlin.random.Random

fun Random.nextFloat(from: Float, to: Float): Float {
    return nextFloat() * (to - from) + from
}

fun Random.nextFloat(until: Float): Float {
    return nextFloat() * until
}

fun Random.nextFloat(range:ClosedRange): Float {
    return nextFloat(range.start, range.endInclusive)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy