Random#
Math / Random
Can Read
Cannot Write
Description#
Returns True or False randomly
Code#
using System;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Get]
[Title("Random")]
[Category("Math/Random")]
[Description("Returns True or False randomly")]
[Image(typeof(IconDice), ColorTheme.Type.Yellow)]
[Keywords("Dice")]
[Serializable]
public class TypeBoolMathRandom : TypeBool
{
public override bool Get(Args args)
{
return UnityEngine.Random.Range(0, 2) == 0;
}
public override string ToString()
{
return "Random";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnUpdate;
}
}