Skip to content

Commit

Permalink
[orx-noise, orx-gui] Deprecate Random
Browse files Browse the repository at this point in the history
  • Loading branch information
edwinRNDR committed Jan 20, 2025
1 parent b631e44 commit b62746c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
9 changes: 4 additions & 5 deletions orx-jvm/orx-gui/src/main/kotlin/Gui.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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.*
Expand Down Expand Up @@ -1101,7 +1100,7 @@ open class GUI(
val currentValue =
(parameter.property as KMutableProperty1<Any, ColorRGBa>).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<Any, ColorRGBa>).set(labeledObject.obj, newValue)
}
Expand All @@ -1111,7 +1110,7 @@ open class GUI(
val max = parameter.doubleRange!!.endInclusive
val currentValue =
(parameter.property as KMutableProperty1<Any, Vector2>).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<Any, Vector2>).set(labeledObject.obj, newValue)
}
Expand All @@ -1131,7 +1130,7 @@ open class GUI(
val max = parameter.doubleRange!!.endInclusive
val currentValue =
(parameter.property as KMutableProperty1<Any, Vector3>).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<Any, Vector3>).set(labeledObject.obj, newValue)
}
Expand All @@ -1141,7 +1140,7 @@ open class GUI(
val max = parameter.doubleRange!!.endInclusive
val currentValue =
(parameter.property as KMutableProperty1<Any, Vector4>).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<Any, Vector4>).set(labeledObject.obj, newValue)
}
Expand Down
1 change: 1 addition & 0 deletions orx-noise/src/commonMain/kotlin/Random.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit b62746c

Please sign in to comment.