Files
2024-10-16 00:03:41 +08:00

47 lines
1.0 KiB
C#

using UnityEngine;
namespace System.RandomPool
{
public static class RandomUtils
{
public static float RandomFloat ()
{
return 1 - UnityEngine.Random.Range (0 , 1f);
}
public static bool HasRandom (float rota)
{
if (rota <= 0)
{
return false;
}
if (rota >= 1)
{
return true;
}
return RandomFloat () <= rota;
}
public static int RandomInt (int min, int max)
{
return UnityEngine.Random.Range (min, max);
}
public static float RandomFloat (float min, float max)
{
return UnityEngine.Random.Range (min, max);
}
public static int Range (int randomCountX, int randomCountY)
{
return RandomInt (randomCountX, randomCountY);
}
public static float RandomFormVector (Vector2 range)
{
return RandomFloat (range.x, range.y);
}
}
}