diff options
author | bnewbold <bnewbold@robocracy.org> | 2010-03-31 08:52:45 +0800 |
---|---|---|
committer | iperry <iperry@gmail.com> | 2010-03-31 09:43:10 +0800 |
commit | 1d3861ef93f8423176c6010ab606abdab00a7cbd (patch) | |
tree | 5c95101e295bcfdd7f9f4292ce9204ddf7e7f662 /src/wiring/wiring_math.cpp | |
parent | 8d6bf3b196c2a0bc1adda4a04669e54fdc5b65cb (diff) | |
download | librambutan-1d3861ef93f8423176c6010ab606abdab00a7cbd.tar.gz librambutan-1d3861ef93f8423176c6010ab606abdab00a7cbd.zip |
Major hierarchy reorganization; see README.
copy-to-ide and Makefile updated to conform; .gitignore added;
LICENSE added
Diffstat (limited to 'src/wiring/wiring_math.cpp')
-rw-r--r-- | src/wiring/wiring_math.cpp | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/src/wiring/wiring_math.cpp b/src/wiring/wiring_math.cpp deleted file mode 100644 index 9be7dc3..0000000 --- a/src/wiring/wiring_math.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include <stdlib.h> -#include "math.h" - -/* from newlib: - * - * rand returns the next pseudo-random integer in sequence; it is a number - * between 0 and RAND_MAX (inclusive). - * - * srand does not return a result. */ - - -/* The rest copied from WMath.cpp */ -void randomSeed(unsigned int seed) { - if (seed != 0) { - srand(seed); - } -} - -long random(long howbig) { - if (howbig == 0) { - return 0; - } - return rand() % howbig; -} - -long random(long howsmall, long howbig) { - if (howsmall >= howbig) { - return howsmall; - } - long diff = howbig - howsmall; - return random(diff) + howsmall; -} - -long map(long x, long in_min, long in_max, long out_min, long out_max) { - return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; -} - - |