Commit 7d8de2d4 authored by Markus Kauppila's avatar Markus Kauppila

Renamed RandomInteger to RandomSint32 and RandomUnsignedInteger

to RandomUint32.
parent 38ba3e64
...@@ -130,13 +130,13 @@ RandomSint16() ...@@ -130,13 +130,13 @@ RandomSint16()
} }
Sint32 Sint32
RandomInteger() RandomSint32()
{ {
return (Sint32) utl_randomInt(&rndContext); return (Sint32) utl_randomInt(&rndContext);
} }
Uint32 Uint32
RandomPositiveInteger() RandomUint32()
{ {
return (Uint32) utl_randomInt(&rndContext); return (Uint32) utl_randomInt(&rndContext);
} }
...@@ -147,8 +147,8 @@ RandomUint64() ...@@ -147,8 +147,8 @@ RandomUint64()
Uint64 value; Uint64 value;
Uint32 *vp = (Uint32*)&value; Uint32 *vp = (Uint32*)&value;
vp[0] = RandomInteger(); vp[0] = RandomSint32();
vp[1] = RandomInteger(); vp[1] = RandomSint32();
return value; return value;
} }
...@@ -159,8 +159,8 @@ RandomSint64() ...@@ -159,8 +159,8 @@ RandomSint64()
Uint64 value; Uint64 value;
Uint32 *vp = (Uint32*)&value; Uint32 *vp = (Uint32*)&value;
vp[0] = RandomInteger(); vp[0] = RandomSint32();
vp[1] = RandomInteger(); vp[1] = RandomSint32();
return value; return value;
} }
...@@ -180,7 +180,7 @@ RandomIntegerInRange(Sint32 pMin, Sint32 pMax) ...@@ -180,7 +180,7 @@ RandomIntegerInRange(Sint32 pMin, Sint32 pMax)
return min; return min;
} }
Sint32 number = abs(utl_randomInt(&rndContext)); Sint32 number = RandomSint32();
return (number % ((max + 1) - min)) + min; return (number % ((max + 1) - min)) + min;
} }
...@@ -287,7 +287,7 @@ RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, SDL_bool validDomain) ...@@ -287,7 +287,7 @@ RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, SDL_bool validDomain)
return 0; return 0;
} }
Uint32 index = RandomInteger() % size; Uint32 index = RandomSint32() % size;
Uint8 retVal = (Uint8) buffer[index]; Uint8 retVal = (Uint8) buffer[index];
SDL_free(buffer); SDL_free(buffer);
...@@ -311,7 +311,7 @@ RandomUint16BoundaryValue(Uint16 boundary1, Uint16 boundary2, SDL_bool validDoma ...@@ -311,7 +311,7 @@ RandomUint16BoundaryValue(Uint16 boundary1, Uint16 boundary2, SDL_bool validDoma
return 0; return 0;
} }
Uint32 index = RandomInteger() % size; Uint32 index = RandomSint32() % size;
Uint16 retVal = (Uint16) buffer[index]; Uint16 retVal = (Uint16) buffer[index];
SDL_free(buffer); SDL_free(buffer);
...@@ -335,7 +335,7 @@ RandomUint32BoundaryValue(Uint32 boundary1, Uint32 boundary2, SDL_bool validDoma ...@@ -335,7 +335,7 @@ RandomUint32BoundaryValue(Uint32 boundary1, Uint32 boundary2, SDL_bool validDoma
return 0; return 0;
} }
Uint32 index = RandomInteger() % size; Uint32 index = RandomSint32() % size;
Uint32 retVal = (Uint32) buffer[index]; Uint32 retVal = (Uint32) buffer[index];
SDL_free(buffer); SDL_free(buffer);
...@@ -359,7 +359,7 @@ RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool validDoma ...@@ -359,7 +359,7 @@ RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool validDoma
return 0; return 0;
} }
Uint32 index = RandomInteger() % size; Uint32 index = RandomSint32() % size;
Uint64 retVal = (Uint64) buffer[index]; Uint64 retVal = (Uint64) buffer[index];
SDL_free(buffer); SDL_free(buffer);
...@@ -476,7 +476,7 @@ RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, SDL_bool validDomain) ...@@ -476,7 +476,7 @@ RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, SDL_bool validDomain)
return CHAR_MIN; return CHAR_MIN;
} }
Uint32 index = RandomInteger() % size; Uint32 index = RandomSint32() % size;
Sint8 retVal = (Sint8) buffer[index]; Sint8 retVal = (Sint8) buffer[index];
SDL_free(buffer); SDL_free(buffer);
...@@ -501,7 +501,7 @@ RandomSint16BoundaryValue(Sint16 boundary1, Sint16 boundary2, SDL_bool validDoma ...@@ -501,7 +501,7 @@ RandomSint16BoundaryValue(Sint16 boundary1, Sint16 boundary2, SDL_bool validDoma
return SHRT_MIN; return SHRT_MIN;
} }
Uint32 index = RandomInteger() % size; Uint32 index = RandomSint32() % size;
Sint16 retVal = (Sint16) buffer[index]; Sint16 retVal = (Sint16) buffer[index];
SDL_free(buffer); SDL_free(buffer);
...@@ -526,7 +526,7 @@ RandomSint32BoundaryValue(Sint32 boundary1, Sint32 boundary2, SDL_bool validDoma ...@@ -526,7 +526,7 @@ RandomSint32BoundaryValue(Sint32 boundary1, Sint32 boundary2, SDL_bool validDoma
return INT_MIN; return INT_MIN;
} }
Uint32 index = RandomInteger() % size; Uint32 index = RandomSint32() % size;
Sint32 retVal = (Sint32) buffer[index]; Sint32 retVal = (Sint32) buffer[index];
SDL_free(buffer); SDL_free(buffer);
...@@ -551,7 +551,7 @@ RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL_bool validDoma ...@@ -551,7 +551,7 @@ RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL_bool validDoma
return LLONG_MIN; return LLONG_MIN;
} }
Uint32 index = RandomInteger() % size; Uint32 index = RandomSint32() % size;
Sint64 retVal = (Sint64) buffer[index]; Sint64 retVal = (Sint64) buffer[index];
SDL_free(buffer); SDL_free(buffer);
...@@ -599,7 +599,7 @@ RandomAsciiStringWithMaximumLength(int maxSize) ...@@ -599,7 +599,7 @@ RandomAsciiStringWithMaximumLength(int maxSize)
return NULL; return NULL;
} }
int size = (abs(RandomInteger()) % (maxSize + 1)) + 1; int size = (abs(RandomSint32()) % (maxSize + 1)) + 1;
char *string = SDL_malloc(size * sizeof(char)); char *string = SDL_malloc(size * sizeof(char));
int counter = 0; int counter = 0;
......
...@@ -80,7 +80,7 @@ Sint16 RandomSint16(); ...@@ -80,7 +80,7 @@ Sint16 RandomSint16();
* *
* \returns Generated integer * \returns Generated integer
*/ */
Sint32 RandomInteger(); Sint32 RandomSint32();
/*! /*!
...@@ -88,7 +88,7 @@ Sint32 RandomInteger(); ...@@ -88,7 +88,7 @@ Sint32 RandomInteger();
* *
* \returns Generated integer * \returns Generated integer
*/ */
Uint32 RandomPositiveInteger(); Uint32 RandomUint32();
/*! /*!
* Returns random Uint64. * Returns random Uint64.
......
...@@ -98,7 +98,7 @@ test_dummy1(void *arg) ...@@ -98,7 +98,7 @@ test_dummy1(void *arg)
/* /*
for( ; 1 ; ) for( ; 1 ; )
Log(0, "uint8 (same value): %u", RandomPositiveInteger()); Log(0, "uint8 (same value): %u", RandomUint32());
// */ // */
//Log(0, "uint8 (same value): %d", RandomUint8BoundaryValue(200, 200, SDL_TRUE)); //Log(0, "uint8 (same value): %d", RandomUint8BoundaryValue(200, 200, SDL_TRUE));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment