15 #ifndef __IPSDKUTIL_INSTRUCTIONSET_ARITHMETIC_DETAIL_STD_UNIFORMRANDOMLCGREG_H__ 16 #define __IPSDKUTIL_INSTRUCTIONSET_ARITHMETIC_DETAIL_STD_UNIFORMRANDOMLCGREG_H__ 21 #include <IPSDKUtil/InstructionSet/Arithmetic/detail/SignedUnsignedOpReg.h> 38 typename boost::enable_if_c<sizeof(T)==1>::type>
53 computeRangeMultiplier(T tMin, T tMax)
55 return (static_cast<FloatType>(tMax) - static_cast<FloatType>(tMin)+1.0) /
62 computeRangeOffset(T tMin, T tMax)
64 return static_cast<FloatType
>(tMin);
74 rSeed = 214013*rSeed+2531011;
75 const ipUInt16 nSeed = 0x7FFF & (rSeed >> 16);
76 const FloatType fSeed =
static_cast<FloatType
>(nSeed);
78 const FloatType fRet = floor(fSeed*rRangeMultiplier) + rRangeOffset;
79 return static_cast<T
>(fRet);
87 typename boost::enable_if_c<sizeof(T)==2>::type>
102 computeRangeMultiplier(T tMin, T tMax)
104 return (static_cast<FloatType>(tMax) - static_cast<FloatType>(tMin)+1.0) /
111 computeRangeOffset(T tMin, T tMax)
113 return static_cast<FloatType
>(tMin);
123 rSeed = 214013*rSeed+2531011;
124 ipUInt16 nSeed = (0x7FFF & (rSeed >> 16)) << 1;
125 rSeed = 214013*rSeed+2531011;
126 nSeed = ((rSeed >> 16) & 0x1) + nSeed;
127 const FloatType fSeed =
static_cast<FloatType
>(nSeed);
128 const FloatType fRet = floor(fSeed*rRangeMultiplier) + rRangeOffset;
129 return static_cast<T
>(fRet);
135 template <
typename T>
137 typename boost::enable_if_c<sizeof(T)==4>::type>
152 computeRangeMultiplier(T tMin, T tMax)
154 return (static_cast<FloatType>(tMax) - static_cast<FloatType>(tMin)+1.0) /
161 computeRangeOffset(T tMin, T tMax)
163 return static_cast<FloatType
>(tMin);
173 rSeed = 214013*rSeed+2531011;
174 ipUInt32 nSeed = (0x7FFF & (rSeed >> 16)) << 17;
175 rSeed = 214013*rSeed+2531011;
176 nSeed = (((rSeed >> 16) & 0x7FFF) << 2) + nSeed;
177 rSeed = 214013*rSeed+2531011;
178 nSeed = ((rSeed >> 16) & 0x3) + nSeed;
180 const FloatType fSeed =
static_cast<FloatType
>(nSeed);
181 const FloatType fRet = floor(fSeed*rRangeMultiplier) + rRangeOffset;
182 return static_cast<T
>(fRet);
206 return (static_cast<FloatType>(tMax) - static_cast<FloatType>(tMin)) /
215 return static_cast<FloatType
>(tMin);
225 rSeed = 214013*rSeed+2531011;
226 ipUInt32 nSeed = (0x7FFF & (rSeed >> 16)) << 17;
227 rSeed = 214013*rSeed+2531011;
228 nSeed = (((rSeed >> 16) & 0x7FFF) << 2) + nSeed;
229 rSeed = 214013*rSeed+2531011;
230 nSeed = ((rSeed >> 16) & 0x3) + nSeed;
232 const FloatType fSeed =
static_cast<FloatType
>(nSeed);
233 const FloatType fRet = fSeed*rRangeMultiplier + rRangeOffset;
258 return (tMax-tMin) / 4294967295.0;
276 rSeed = 214013*rSeed+2531011;
277 ipUInt32 nSeed = (0x7FFF & (rSeed >> 16)) << 17;
278 rSeed = 214013*rSeed+2531011;
279 nSeed = (((rSeed >> 16) & 0x7FFF) << 2) + nSeed;
280 rSeed = 214013*rSeed+2531011;
281 nSeed = ((rSeed >> 16) & 0x3) + nSeed;
283 const FloatType fSeed =
static_cast<FloatType
>(nSeed);
284 const FloatType fRet = fSeed*rRangeMultiplier + rRangeOffset;
296 #endif // __IPSDKUTIL_INSTRUCTIONSET_ARITHMETIC_DETAIL_STD_ABSPACK_H__ Defines the IPSDK_FORCEINLINE.
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
double ipReal64
Base types definition.
Definition: BaseTypes.h:57
eInstructionSet
Enumerate for processor instruction set description.
Definition: InstructionSetTypes.h:31
Definition: UniformRandomLCGReg.h:29
Definition of import/export macro for library.
compiler optimisations only
Definition: InstructionSetTypes.h:34
uint16_t ipUInt16
Base types definition.
Definition: BaseTypes.h:51
float ipReal32
Base types definition.
Definition: BaseTypes.h:56
uint32_t ipUInt32
Base types definition.
Definition: BaseTypes.h:53