Random Int


Node Information
Generates a random number between the two given values each time it is requested.
General Information
• This node doesn't have other available options.
Visual
Visual

Ports
Text Type DataType Accepts IsList CustomAcception
Min IN Int32 ONE FALSE FALSE
Max IN Int32 ONE FALSE FALSE
Value OUT Int32 MULTIPLE FALSE FALSE

Source
namespace Korduene.KGraph.Nodes.Utilities
{
    [IsNode("Random Int")]
    public class RandomInt : Node
    {
        Port min = new Port(PortType.IN, typeof(int), AcceptsLinks.ONE, "Min");
        Port max = new Port(PortType.IN, typeof(int), AcceptsLinks.ONE, "Max");
        Port val = new Port(PortType.OUT, typeof(int), AcceptsLinks.MULTIPLE, "Value");
        public int Min
        {
            set
            {
                if (value > Max)
                {
                    value = Max - 1;
                }
                min.Value = value.ToString();
            }
            get { return GetRuntimeValue(min); }
        }
        public int Max
        {
            set
            {
                if (value < min)="" {="" value="Min" +="" 1;="" }="" max.value="value.ToString();" }="" get="" {="" return="" getruntimevalue(max);="" }="" }="" public="" randomint()="" {="" name="Random Int" ;="" nodetype="KGraph.NodeType.Function;" returntype="typeof(int);" addport(min);="" addport(max);="" addport(val);="" information="Generates a random number between the two given values each time it is requested." ;="" }="" public="" override="" string="" code()="" {="" string="" ret="rnd.Next()" ;="" string="" mi="GetValue(min);" string="" ma="GetValue(max);" if="" (mi="" !="ma)" {="" ret="rnd.Next(" +="" getvalue(min)="" +="" ","="" +="" getvalue(max)="" +="" ")";="" }="" return="" "random="" rnd="new" random();="" return="" "="" +="" ret="" +="" ";";="" }="" }="" }="">