You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.5 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MyFirstMAUI.Utility
{
internal class Utils
{
// 노 파 빨 회 초
public static Color[] Palettes = new Color[]
{
Color.FromRgb(245, 233, 77),
Color.FromRgb(15, 76, 129),
Color.FromRgb(191, 25, 50),
Color.FromRgb(147, 149, 151),
Color.FromRgb(0, 148, 115),
};
private static int _callCount = 1;
// 1-10, 11-20, 21-30, 31-40, 41-45
public static int GetNumber(int index)
{
if (_callCount > int.MaxValue / 2)
_callCount = 1;
int min = 1;
int max = 46;
switch (index)
{
case 0:
min = 1;
max = 11;
break;
case 1:
min = 11;
max = 21;
break;
case 2:
min = 21;
max = 31;
break;
case 3:
min = 31;
max = 41;
break;
case 4:
min = 41;
max = 46;
break;
default:
break;
}
Random rand = new Random(unchecked((int)DateTime.Now.Ticks) + _callCount);
return rand.Next(min, max);
}
}
}