| 154 | |
| 155 | template <class TSource, class TDesired> |
| 156 | TDesired NextLENarrow(TSource modifier = 0) |
| 157 | { |
| 158 | static_assert(sizeof(TSource) > sizeof(TDesired), "Can only narrow to a smaller type"); |
| 159 | TSource value = SwapLE(Next<TSource>()) + modifier; |
| 160 | return static_cast<TDesired>(clamp<TSource>(value, std::numeric_limits<TDesired>::min(), std::numeric_limits<TDesired>::max())); |
| 161 | } |
| 162 | |
| 163 | bool NextBool8() |
| 164 | { |