code cleanup

master
Robinson 2023-08-01 20:26:17 -06:00
parent fc3eadd8f2
commit b08748e620
No known key found for this signature in database
GPG Key ID: 8E7DB78588BD6F5C
1 changed files with 9 additions and 2 deletions

View File

@ -36,7 +36,6 @@ object Collections {
}
/** Returns a random number between start (inclusive) and end (inclusive). */
@JvmStatic
fun random(start: Int, end: Int): Int {
return start + random.nextInt(end - start + 1)
}
@ -44,8 +43,16 @@ object Collections {
/**
* Returns the next power of two. Returns the specified value if the value is already a power of two.
*/
@JvmStatic
fun nextPowerOfTwo(value: Int): Int {
return 1 shl 32 - Integer.numberOfLeadingZeros(value - 1)
}
/**
* When true, [Iterable.iterator] for [ObjectMap], and other collections will allocate a new
* iterator for each invocation.
*
* When false, the iterator is reused and nested use will throw an exception. Default is
* false.
*/
var allocateIterators = false
}