We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0fca8d6 commit a57d69eCopy full SHA for a57d69e
src/main/kotlin/com/lambda/util/math/Linear.kt
@@ -23,6 +23,7 @@ import net.minecraft.util.math.Vec3d
23
import java.awt.Color
24
import kotlin.math.max
25
import kotlin.math.min
26
+import kotlin.random.Random
27
import kotlin.random.Random.Default.nextDouble
28
29
/**
@@ -46,7 +47,7 @@ fun ClosedRange<Float>.step(step: Float) = object : FloatIterator() {
46
47
48
* Returns a random number within the range.
49
*/
-fun ClosedRange<Double>.random() = nextDouble(start, endInclusive)
50
+fun ClosedRange<Double>.random(random: Random = Random) = start + (endInclusive - start) * random.nextDouble()
51
52
53
* Converts a value from one range to a normalized value between 0 and 1.
0 commit comments