LootBoxGenerator/LootBoxSimulator/Program.cs

41 lines
957 B
C#
Raw Normal View History

2024-12-17 15:06:26 +00:00

decimal [] test = [0.25M, 0.5M, 0.125M , 0.125M];
//(start)-(end)
//(0,5) - (0,5+ 0,25)
//(0,5 + 0,25) - (0,5 + 0,25 + 0,125)
//(0,5 + 0,25 + 0,125) - (0,5 + 0,25 + 0,125 + 0,1)
//0.5 0
//0.25 1
2024-12-05 11:29:52 +00:00
2024-12-17 15:06:26 +00:00
//0-1
//0.5 0.25 0.125 0.125
//0 - 0.5 //unrare
//0.5 - 0.75 //rare
//0.75 - 0.875 //epic
//0.875 - 1 //legend
test = test.OrderByDescending(it => it).ToArray();
foreach (var @decimal in test)
2024-12-16 06:29:02 +00:00
{
2024-12-17 15:06:26 +00:00
Console.WriteLine(@decimal);
2024-12-16 11:24:55 +00:00
}
2024-12-16 13:07:23 +00:00
2024-12-17 15:06:26 +00:00
Random random = new Random();
decimal number = Convert.ToDecimal(Math.Round(random.NextDouble(),2));
Console.WriteLine($"Random number: {number}");
decimal startRange = 0;
decimal endRange = test[0];
if(number >= startRange && number <= endRange) Console.WriteLine(true);
for (int i = 1; i < test.Length; i++)
2024-12-16 13:07:23 +00:00
{
2024-12-17 15:06:26 +00:00
startRange = endRange;
endRange = startRange + test[i];
if (number >= startRange && number <= endRange)
{
Console.WriteLine($"{startRange} - {endRange} {true}");
2024-12-16 13:07:23 +00:00
break;
2024-12-17 15:06:26 +00:00
}
2024-12-17 06:38:50 +00:00
}
2024-12-17 12:43:34 +00:00