mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-09 06:35:42 +12:00
21 lines
428 B
C#
21 lines
428 B
C#
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;
|
|
}
|
|
}
|
|
}
|