From b62746c94ea3e0b034c482ba2a244116861c8c76 Mon Sep 17 00:00:00 2001 From: Edwin Jakobs Date: Mon, 20 Jan 2025 11:37:52 +0100 Subject: [PATCH] [orx-noise, orx-gui] Deprecate Random --- orx-jvm/orx-gui/src/main/kotlin/Gui.kt | 9 ++++----- orx-noise/src/commonMain/kotlin/Random.kt | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/orx-jvm/orx-gui/src/main/kotlin/Gui.kt b/orx-jvm/orx-gui/src/main/kotlin/Gui.kt index 6e00330b9..05ca5b82a 100644 --- a/orx-jvm/orx-gui/src/main/kotlin/Gui.kt +++ b/orx-jvm/orx-gui/src/main/kotlin/Gui.kt @@ -8,7 +8,6 @@ import org.openrndr.* import org.openrndr.color.ColorRGBa import org.openrndr.dialogs.* import org.openrndr.draw.Drawer -import org.openrndr.extra.noise.Random import org.openrndr.extra.noise.random import org.openrndr.extra.noise.uniform import org.openrndr.extra.parameters.* @@ -1101,7 +1100,7 @@ open class GUI( val currentValue = (parameter.property as KMutableProperty1).get(labeledObject.obj) val randomValue = - ColorRGBa.fromVector(Random.vector3(0.0, 1.0), currentValue.alpha, currentValue.linearity) + ColorRGBa.fromVector(Vector3.uniform(0.0, 1.0), currentValue.alpha, currentValue.linearity) val newValue = currentValue.mix(randomValue, strength) (parameter.property as KMutableProperty1).set(labeledObject.obj, newValue) } @@ -1111,7 +1110,7 @@ open class GUI( val max = parameter.doubleRange!!.endInclusive val currentValue = (parameter.property as KMutableProperty1).get(labeledObject.obj) - val randomValue = Random.vector2(min, max) + val randomValue = Vector2.uniform(min, max) val newValue = currentValue.mix(randomValue, strength) (parameter.property as KMutableProperty1).set(labeledObject.obj, newValue) } @@ -1131,7 +1130,7 @@ open class GUI( val max = parameter.doubleRange!!.endInclusive val currentValue = (parameter.property as KMutableProperty1).get(labeledObject.obj) - val randomValue = Random.vector3(min, max) + val randomValue = Vector3.uniform(min, max) val newValue = currentValue.mix(randomValue, strength) (parameter.property as KMutableProperty1).set(labeledObject.obj, newValue) } @@ -1141,7 +1140,7 @@ open class GUI( val max = parameter.doubleRange!!.endInclusive val currentValue = (parameter.property as KMutableProperty1).get(labeledObject.obj) - val randomValue = Random.vector4(min, max) + val randomValue = Vector4.uniform(min, max) val newValue = currentValue.mix(randomValue, strength) (parameter.property as KMutableProperty1).set(labeledObject.obj, newValue) } diff --git a/orx-noise/src/commonMain/kotlin/Random.kt b/orx-noise/src/commonMain/kotlin/Random.kt index 63ebcc4ad..1785224cc 100644 --- a/orx-noise/src/commonMain/kotlin/Random.kt +++ b/orx-noise/src/commonMain/kotlin/Random.kt @@ -13,6 +13,7 @@ private data class RandomState(var seed: String, var rng: DefaultRandom) /** * Deterministic Random using a seed to guarantee the same random values between iterations */ +@Deprecated("Duplicate functionality") object Random { var rnd: DefaultRandom