diff options
author | Jacek Antonelli | 2008-08-15 23:44:50 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:50 -0500 |
commit | 89fe5dab825a62a0e3fd8d248cbc91c65eb2a426 (patch) | |
tree | bcff14b7888d04a2fec799c59369f6095224bd08 /linden/indra/llmath/llrand.cpp | |
parent | Second Life viewer sources 1.13.3.2 (diff) | |
download | meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.zip meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.gz meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.bz2 meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.xz |
Second Life viewer sources 1.14.0.0
Diffstat (limited to 'linden/indra/llmath/llrand.cpp')
-rw-r--r-- | linden/indra/llmath/llrand.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/linden/indra/llmath/llrand.cpp b/linden/indra/llmath/llrand.cpp index c0f03d2..ae52010 100644 --- a/linden/indra/llmath/llrand.cpp +++ b/linden/indra/llmath/llrand.cpp | |||
@@ -140,7 +140,14 @@ F32 ll_frand(F32 val) | |||
140 | { | 140 | { |
141 | // The clamping rules are described above. | 141 | // The clamping rules are described above. |
142 | F32 rv = ll_internal_random_float() * val; | 142 | F32 rv = ll_internal_random_float() * val; |
143 | if(rv >= val) return 0.0f; | 143 | if(val > 0) |
144 | { | ||
145 | if(rv >= val) return 0.0f; | ||
146 | } | ||
147 | else | ||
148 | { | ||
149 | if(rv <= val) return 0.0f; | ||
150 | } | ||
144 | return rv; | 151 | return rv; |
145 | } | 152 | } |
146 | 153 | ||
@@ -153,6 +160,13 @@ F64 ll_drand(F64 val) | |||
153 | { | 160 | { |
154 | // The clamping rules are described above. | 161 | // The clamping rules are described above. |
155 | F64 rv = ll_internal_random_double() * val; | 162 | F64 rv = ll_internal_random_double() * val; |
156 | if(rv >= val) return 0.0; | 163 | if(val > 0) |
164 | { | ||
165 | if(rv >= val) return 0.0; | ||
166 | } | ||
167 | else | ||
168 | { | ||
169 | if(rv <= val) return 0.0; | ||
170 | } | ||
157 | return rv; | 171 | return rv; |
158 | } | 172 | } |