| 174 | | const static real min = 0; |
|---|
| 175 | | const static real max = cast(real)(baseEngine.max - baseEngine.min) * (1.l / denominator); |
|---|
| 176 | | |
|---|
| 177 | | private const static real denominator = |
|---|
| 178 | | cast(real)(cast(ulong)(baseEngine.max - baseEngine.min) + (closed ? 0 : 1)); |
|---|
| | 174 | const static |
|---|
| | 175 | { |
|---|
| | 176 | real min = (closedLeft ? 0 : increment) * (1/denominator); |
|---|
| | 177 | real max = (range + (closedLeft ? 0 : increment)) * (1/denominator); |
|---|
| | 178 | } |
|---|
| | 179 | |
|---|
| | 180 | private const static |
|---|
| | 181 | { |
|---|
| | 182 | real range = cast(real)(baseEngine.max - baseEngine.min); |
|---|
| | 183 | real increment = (baseEngine.max > uint.max) ? 2.l : 0.2l; |
|---|
| | 184 | real denominator = range + (closedLeft ? 0 : increment) + (closedRight ? 0 : increment); |
|---|
| | 185 | } |
|---|
| 206 | | static assert(UnitUniformEngine!(Rand48Engine, true).max == 1.l); |
|---|
| 207 | | static assert(UnitUniformEngine!(Rand48Engine, false).max < 1.l); |
|---|
| | 213 | alias UnitUniformEngine!(Rand48Engine, true, true) fullClosed; |
|---|
| | 214 | alias UnitUniformEngine!(Rand48Engine, true, false) closedLeft; |
|---|
| | 215 | alias UnitUniformEngine!(Rand48Engine, false, true) closedRight; |
|---|
| | 216 | alias UnitUniformEngine!(Rand48Engine, false, false) fullOpened; |
|---|
| | 217 | |
|---|
| | 218 | static assert(fullClosed.min == 0.l); |
|---|
| | 219 | static assert(fullClosed.max == 1.l); |
|---|
| | 220 | |
|---|
| | 221 | static assert(closedLeft.min == 0.l); |
|---|
| | 222 | static assert(closedLeft.max < 1.l); |
|---|
| | 223 | |
|---|
| | 224 | static assert(closedRight.min > 0.l); |
|---|
| | 225 | static assert(closedRight.max == 1.l); |
|---|
| | 226 | |
|---|
| | 227 | static assert(fullOpened.min > 0.l); |
|---|
| | 228 | static assert(fullOpened.max < 1.l); |
|---|
| 252 | | static assert(HighresUnitUniformEngine!(Rand48Engine, true).max == 1.l); |
|---|
| 253 | | static assert(HighresUnitUniformEngine!(Rand48Engine, false).max < 1.l); |
|---|
| 254 | | } |
|---|
| | 281 | alias HighresUnitUniformEngine!(Rand48Engine, true, true) fullClosed; |
|---|
| | 282 | alias HighresUnitUniformEngine!(Rand48Engine, true, false) closedLeft; |
|---|
| | 283 | alias HighresUnitUniformEngine!(Rand48Engine, false, true) closedRight; |
|---|
| | 284 | alias HighresUnitUniformEngine!(Rand48Engine, false, false) fullOpened; |
|---|
| | 285 | |
|---|
| | 286 | static assert(fullClosed.min == 0.l); |
|---|
| | 287 | static assert(fullClosed.max == 1.l); |
|---|
| | 288 | |
|---|
| | 289 | static assert(closedLeft.min == 0.l); |
|---|
| | 290 | static assert(closedLeft.max < 1.l); |
|---|
| | 291 | |
|---|
| | 292 | static assert(closedRight.min > 0.l); |
|---|
| | 293 | static assert(closedRight.max == 1.l); |
|---|
| | 294 | |
|---|
| | 295 | static assert(fullOpened.min > 0.l); |
|---|
| | 296 | static assert(fullOpened.max < 1.l); |
|---|
| | 297 | } |
|---|