rj-action-library/Runtime/Random/GodotRandom.cs

38 lines
584 B
C#

using System.Collections;
using System.Collections.Generic;
using Godot;
using System;
namespace Rokojori
{
public class GodotRandom:RandomEngine
{
static GodotRandom _instance;
public static GodotRandom Get()
{
if ( _instance != null )
{
return _instance;
}
_instance = new GodotRandom();
return _instance;
}
RandomNumberGenerator rng;
public GodotRandom()
{
rng = new RandomNumberGenerator();
rng.Randomize();
}
public override float Next()
{
return rng.Randf();
}
}
}