generated from freudenreichan/info2Praktikum-DobleSpiel
Final fix of doble numbers
This commit is contained in:
parent
4b81d627f5
commit
bbf0460d1a
@ -1,3 +1,9 @@
|
|||||||
|
thilo;19753
|
||||||
|
thilo;14880
|
||||||
|
thilo;14733
|
||||||
|
player1;9956
|
||||||
|
player2;4988
|
||||||
player1;4980
|
player1;4980
|
||||||
player_name;4980
|
player_name;4980
|
||||||
|
player2;4885
|
||||||
player1;3999
|
player1;3999
|
||||||
|
|||||||
27
numbers.c
27
numbers.c
@ -73,11 +73,36 @@ unsigned int *createNumbers(unsigned int len)
|
|||||||
|
|
||||||
srand(time(NULL));
|
srand(time(NULL));
|
||||||
|
|
||||||
for (unsigned int i = 0; i < len; i++)
|
/*for (unsigned int i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
array[i] = rand() % (2*len) + 1;
|
array[i] = rand() % (2*len) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
TreeNode *root = NULL;
|
||||||
|
int isDuplicate;
|
||||||
|
unsigned int value;
|
||||||
|
unsigned int i = 0;
|
||||||
|
|
||||||
|
srand(time(NULL));
|
||||||
|
|
||||||
|
while (i < len)
|
||||||
|
{
|
||||||
|
value = rand() % (2 * len) + 1;
|
||||||
|
|
||||||
|
root = addToTree(root, &value, sizeof(unsigned int), compareFct, &isDuplicate);
|
||||||
|
|
||||||
|
if (isDuplicate == 0)
|
||||||
|
{
|
||||||
|
array[i] = value;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
// Bei Duplikat: nochmal versuchen, kein Inkrement
|
||||||
|
}
|
||||||
|
|
||||||
|
clearTree(root);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
position = rand() % len;
|
position = rand() % len;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user