examples/demo: Set the RNG to xoshiro256

The example should run on any target, not just first class ones.
This commit is contained in:
Yawning Angel
2025-11-25 03:59:18 +09:00
parent 73883b70c8
commit 0bd6410ea3

View File

@@ -11,6 +11,7 @@ import "core:reflect"
import "base:runtime"
import "base:intrinsics"
import "core:math/big"
import "core:math/rand"
/*
Odin is a general-purpose programming language with distinct typing built
@@ -2258,6 +2259,10 @@ arbitrary_precision_mathematics :: proc() {
a, b, c, d, e, f, res := &big.Int{}, &big.Int{}, &big.Int{}, &big.Int{}, &big.Int{}, &big.Int{}, &big.Int{}
defer big.destroy(a, b, c, d, e, f, res)
// Set the context RNG to something that does not require
// cryptographic entropy (not supported on all targets).
context.random_generator = rand.xoshiro256_random_generator()
// How many bits should the random prime be?
bits := 64
// Number of Rabin-Miller trials, -1 for automatic.