Revision 1025,
417 bytes
checked in by gumbau, 18 years ago
(diff) |
namespace simplif
|
Rev | Line | |
---|
[774] | 1 | #ifndef GFXMATH_RANDOM_INCLUDED // -*- C++ -*-
|
---|
| 2 | #define GFXMATH_RANDOM_INCLUDED
|
---|
| 3 |
|
---|
| 4 | #include <stdlib.h>
|
---|
| 5 | #include <limits.h>
|
---|
| 6 |
|
---|
[1025] | 7 | namespace simplif
|
---|
[774] | 8 | {
|
---|
| 9 | //
|
---|
| 10 | // Generate random numbers in [0..1]
|
---|
| 11 | inline real random1()
|
---|
| 12 | {
|
---|
| 13 | #if defined(WIN32) || defined(GFX_USE_RAND)
|
---|
| 14 | return (real)rand() / (real)LONG_MAX;
|
---|
| 15 | #else
|
---|
| 16 | return (real)random() / (real)LONG_MAX;
|
---|
| 17 | #endif
|
---|
| 18 | }
|
---|
| 19 |
|
---|
| 20 | }
|
---|
| 21 |
|
---|
| 22 |
|
---|
| 23 | // GFXMATH_RANDOM_INCLUDED
|
---|
| 24 | #endif
|
---|
Note: See
TracBrowser
for help on using the repository browser.