1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2025-07-06 07:44:57 +03:00

v4.07-9448-rtm

This commit is contained in:
dnobori
2014-06-06 06:53:20 +09:00
parent 7839d2939e
commit 719ee999d6
333 changed files with 1412 additions and 346 deletions

View File

@ -2005,6 +2005,41 @@ int CompareInt64(void *p1, void *p2)
return COMPARE_RET(*v1, *v2);
}
// Randomize the contents of the list
void RandomizeList(LIST *o)
{
LIST *o2;
UINT i;
// Validate arguments
if (o == NULL)
{
return;
}
o2 = NewListFast(NULL);
while (LIST_NUM(o) != 0)
{
UINT num = LIST_NUM(o);
UINT i = Rand32() % num;
void *p = LIST_DATA(o, i);
Add(o2, p);
Delete(o, p);
}
DeleteAll(o);
for (i = 0;i < LIST_NUM(o2);i++)
{
void *p = LIST_DATA(o2, i);
Add(o, p);
}
ReleaseList(o2);
}
// Add an integer to the list
void AddInt(LIST *o, UINT i)
{