mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
32 lines
708 B
C#
32 lines
708 B
C#
using Artemis.Core;
|
|
|
|
namespace Artemis.VisualScripting.Nodes.Static;
|
|
|
|
[Node("Random", "Generates a random value between 0 and 1", "Static", OutputType = typeof(Numeric))]
|
|
public class RandomNumericValueNode : Node
|
|
{
|
|
#region Properties & Fields
|
|
|
|
private static readonly Random RANDOM = new();
|
|
|
|
public OutputPin<Numeric> Output { get; }
|
|
|
|
#endregion
|
|
|
|
#region Constructors
|
|
|
|
public RandomNumericValueNode()
|
|
: base("Random", "Generates a random value between 0 and 1")
|
|
{
|
|
Output = CreateOutputPin<Numeric>();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Methods
|
|
|
|
/// <inheritdoc />
|
|
public override void Evaluate() => Output.Value = RANDOM.NextSingle();
|
|
|
|
#endregion
|
|
} |