nextRange for floats
This commit is contained in:
parent
900ce863ae
commit
f77cf29567
@ -5,6 +5,7 @@ import com.google.gson.JsonElement
|
|||||||
import it.unimi.dsi.fastutil.bytes.ByteConsumer
|
import it.unimi.dsi.fastutil.bytes.ByteConsumer
|
||||||
import org.classdump.luna.ByteString
|
import org.classdump.luna.ByteString
|
||||||
import ru.dbotthepony.kommons.util.IStruct2d
|
import ru.dbotthepony.kommons.util.IStruct2d
|
||||||
|
import ru.dbotthepony.kommons.util.IStruct2f
|
||||||
import ru.dbotthepony.kommons.util.IStruct2i
|
import ru.dbotthepony.kommons.util.IStruct2i
|
||||||
import ru.dbotthepony.kommons.util.XXHash32
|
import ru.dbotthepony.kommons.util.XXHash32
|
||||||
import ru.dbotthepony.kommons.util.XXHash64
|
import ru.dbotthepony.kommons.util.XXHash64
|
||||||
@ -263,6 +264,10 @@ fun RandomGenerator.nextRange(range: IStruct2d): Double {
|
|||||||
return if (range.component1() == range.component2()) return range.component1() else nextDouble(range.component1(), range.component2())
|
return if (range.component1() == range.component2()) return range.component1() else nextDouble(range.component1(), range.component2())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun RandomGenerator.nextRange(range: IStruct2f): Float {
|
||||||
|
return if (range.component1() == range.component2()) return range.component1() else nextFloat(range.component1(), range.component2())
|
||||||
|
}
|
||||||
|
|
||||||
fun <T> MutableList<T>.shuffle(random: RandomGenerator) {
|
fun <T> MutableList<T>.shuffle(random: RandomGenerator) {
|
||||||
for (i in 0 until size) {
|
for (i in 0 until size) {
|
||||||
val rand = random.nextInt(size)
|
val rand = random.nextInt(size)
|
||||||
|
Loading…
Reference in New Issue
Block a user