diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/util/random/RandomUtils.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/util/random/RandomUtils.kt index 45b064c1..39de2880 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/util/random/RandomUtils.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/util/random/RandomUtils.kt @@ -5,6 +5,7 @@ import com.google.gson.JsonElement import it.unimi.dsi.fastutil.bytes.ByteConsumer import org.classdump.luna.ByteString import ru.dbotthepony.kommons.util.IStruct2d +import ru.dbotthepony.kommons.util.IStruct2f import ru.dbotthepony.kommons.util.IStruct2i import ru.dbotthepony.kommons.util.XXHash32 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()) } +fun RandomGenerator.nextRange(range: IStruct2f): Float { + return if (range.component1() == range.component2()) return range.component1() else nextFloat(range.component1(), range.component2()) +} + fun MutableList.shuffle(random: RandomGenerator) { for (i in 0 until size) { val rand = random.nextInt(size)