Merge pull request #676 from birarda/master

make randIntInRange and randomColorValue inclusive on max side
This commit is contained in:
ZappoMan 2013-07-15 16:31:25 -07:00
commit dc0b4d3e99
2 changed files with 3 additions and 3 deletions

View file

@ -434,7 +434,7 @@ void sendDanceFloor() {
for (int i = 0; i < DANCE_FLOOR_WIDTH; i++) {
for (int j = 0; j < DANCE_FLOOR_LENGTH; j++) {
int randomColorIndex = randIntInRange( -(DANCE_FLOOR_COLORS), (DANCE_FLOOR_COLORS + 1));
int randomColorIndex = randIntInRange(-DANCE_FLOOR_COLORS, DANCE_FLOOR_COLORS);
::danceFloorColors[i][j] = randomColorIndex;
::danceFloorLights[i][j] = ::danceFloorPosition +
glm::vec3(i * DANCE_FLOOR_LIGHT_SIZE, 0, j * DANCE_FLOOR_LIGHT_SIZE);

View file

@ -40,7 +40,7 @@ float randFloat () {
}
int randIntInRange (int min, int max) {
return min + (rand() % (max - min));
return min + (rand() % ((max + 1) - min));
}
float randFloatInRange (float min,float max) {
@ -48,7 +48,7 @@ float randFloatInRange (float min,float max) {
}
unsigned char randomColorValue(int miniumum) {
return miniumum + (rand() % (255 - miniumum));
return miniumum + (rand() % (256 - miniumum));
}
bool randomBoolean() {