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

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

package ru.casperix.math.random

import ru.casperix.math.geometry.PI2
import ru.casperix.math.geometry.fPI2
import ru.casperix.math.polar.float32.PolarCoordinateFloat
import ru.casperix.math.polar.float64.PolarCoordinateDouble
import kotlin.random.Random

fun Random.nextPolarCoordinateFloat(
    minRange: Float = 0f,
    maxRange: Float = 1f,
    minAngle: Float = 0f,
    maxAngle: Float = fPI2
): PolarCoordinateFloat {
    return PolarCoordinateFloat(nextFloat(minRange, maxRange), nextRadianFloat(minAngle, maxAngle))
}

fun Random.nextPolarCoordinateDouble(
    minRange: Double = 0.0,
    maxRange: Double = 1.0,
    minAngle: Double = 0.0,
    maxAngle: Double = PI2
): PolarCoordinateDouble {
    return PolarCoordinateDouble(nextDouble(minRange, maxRange), nextRadianDouble(minAngle, maxAngle))
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy