comparison Xcode-iPhoneOS/Demos/src/common.c @ 3277:20326ba2bda2

This name inconsistency has been bugging me for a while...
author Sam Lantinga <slouken@libsdl.org>
date Sat, 19 Sep 2009 07:32:36 +0000
parents
children
comparison
equal deleted inserted replaced
3276:720d176be107 3277:20326ba2bda2
1 /*
2 * common.c
3 * written by Holmes Futrell
4 * use however you want
5 */
6
7 #include "common.h"
8 #include "SDL.h"
9 #include <stdlib.h>
10
11 /*
12 Produces a random int x, min <= x <= max
13 following a uniform distribution
14 */
15 int
16 randomInt(int min, int max)
17 {
18 return min + rand() % (max - min + 1);
19 }
20
21 /*
22 Produces a random float x, min <= x <= max
23 following a uniform distribution
24 */
25 float
26 randomFloat(float min, float max)
27 {
28 return rand() / (float) RAND_MAX *(max - min) + min;
29 }
30
31 void
32 fatalError(const char *string)
33 {
34 printf("%s: %s\n", string, SDL_GetError());
35 exit(1);
36 }