correct impl for RNG of joise lib

This commit is contained in:
minjaesong
2019-07-27 14:45:19 +09:00
parent 1691fc41e5
commit 155c38536f
4 changed files with 58 additions and 10 deletions

View File

@@ -0,0 +1,32 @@
package net.torvald.terrarum.tests
import net.torvald.random.HQRNG
import java.util.*
/**
* Created by minjaesong on 2019-07-27.
*/
fun rng01(rng: Random): Double {
return (rng.nextInt().toDouble() / 4294967295L.toDouble())
}
fun main(args: Array<String>) {
val rng = HQRNG()
/*repeat(512) {
println(rng.nextDouble())
}*/
println()
val rng2 = com.sudoplay.joise.generator.HQRNG()
repeat(512) {
println(rng2.getRange(0, 10))
}
// getTarget: 0..(t-1) (exclusive)
// getRange: low..high (inclusive)
// get01: 0.0 until 1.0 (exclusive)
}