mirror of
https://github.com/ConjureETS/DeathBook.git
synced 2026-03-24 20:40:57 +00:00
38 lines
704 B
C#
38 lines
704 B
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace DeathBook.Model
|
|
{
|
|
public class Utils
|
|
{
|
|
public static void Test()
|
|
{
|
|
float mean = 50;
|
|
float range = 50;
|
|
int numSteps = 2;
|
|
|
|
int numTries = 100;
|
|
|
|
for (int i = 0; i < numTries; i++)
|
|
{
|
|
Debug.Log(GetRandomValue(mean, range, numSteps));
|
|
}
|
|
}
|
|
|
|
public static float GetRandomValue(float mean, float range, int numSteps)
|
|
{
|
|
float sum = 0;
|
|
for (int i = 0; i < numSteps; i++)
|
|
{
|
|
sum += Random.value;
|
|
}
|
|
return (sum / numSteps * 2 - 1) * range + mean;
|
|
}
|
|
|
|
public static string GetTimeString(int time)
|
|
{
|
|
return time / 60 + "h " + time % 60 + "m";
|
|
}
|
|
}
|
|
}
|