diff options
| author | gingerBill <bill@gingerbill.org> | 2024-06-15 15:43:57 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-06-15 15:43:57 +0100 |
| commit | 149ecafdeff6ff2b579ab1c979c147fd04fe4228 (patch) | |
| tree | 58645f16c27ca623907d8ab778be958ba96efaaa /core/math/big/internal.odin | |
| parent | 7ec17ecf98c5151b31f7b0a3e090d6b5a4d12c54 (diff) | |
Remove the need for `rand` in `core:math/big`
Diffstat (limited to 'core/math/big/internal.odin')
| -rw-r--r-- | core/math/big/internal.odin | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/core/math/big/internal.odin b/core/math/big/internal.odin index 29bdf555c..c9b331e55 100644 --- a/core/math/big/internal.odin +++ b/core/math/big/internal.odin @@ -2817,11 +2817,11 @@ internal_platform_count_lsb :: #force_inline proc(a: $T) -> (count: int) internal_count_lsb :: proc { internal_int_count_lsb, internal_platform_count_lsb, } -internal_int_random_digit :: proc(r: ^rnd.Rand = nil) -> (res: DIGIT) { +internal_int_random_digit :: proc() -> (res: DIGIT) { when _DIGIT_BITS == 60 { // DIGIT = u64 - return DIGIT(rnd.uint64(r)) & _MASK + return DIGIT(rnd.uint64()) & _MASK } else when _DIGIT_BITS == 28 { // DIGIT = u32 - return DIGIT(rnd.uint32(r)) & _MASK + return DIGIT(rnd.uint32()) & _MASK } else { panic("Unsupported DIGIT size.") } @@ -2829,7 +2829,7 @@ internal_int_random_digit :: proc(r: ^rnd.Rand = nil) -> (res: DIGIT) { return 0 // We shouldn't get here. } -internal_int_random :: proc(dest: ^Int, bits: int, r: ^rnd.Rand = nil, allocator := context.allocator) -> (err: Error) { +internal_int_random :: proc(dest: ^Int, bits: int, allocator := context.allocator) -> (err: Error) { context.allocator = allocator bits := bits @@ -2846,7 +2846,7 @@ internal_int_random :: proc(dest: ^Int, bits: int, r: ^rnd.Rand = nil, allocator #force_inline internal_grow(dest, digits) or_return for i := 0; i < digits; i += 1 { - dest.digit[i] = int_random_digit(r) & _MASK + dest.digit[i] = int_random_digit() & _MASK } if bits > 0 { dest.digit[digits - 1] &= ((1 << uint(bits)) - 1) |