mirror of
https://github.com/islehorse/HISP.git
synced 2025-06-06 11:01:27 +12:00
Add Feature pt1
This commit is contained in:
parent
a184e4d735
commit
092534e331
131 changed files with 3113 additions and 1418 deletions
21
HorseIsleServer/LibHISP/Security/RandomID.cs
Normal file
21
HorseIsleServer/LibHISP/Security/RandomID.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
namespace HISP.Security
|
||||
{
|
||||
public class RandomID
|
||||
{
|
||||
private static int prevId = 0;
|
||||
public static int NextRandomId(int randomId=-1)
|
||||
{
|
||||
int rndmId = 0;
|
||||
|
||||
if (randomId == -1)
|
||||
rndmId = prevId+1;
|
||||
else
|
||||
rndmId = randomId;
|
||||
|
||||
if (rndmId >= prevId)
|
||||
prevId = rndmId;
|
||||
|
||||
return rndmId;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue