mirror of
https://github.com/odin-lang/Odin.git
synced 2025-12-28 08:54:35 +00:00
examples/demo: Set the RNG to xoshiro256
The example should run on any target, not just first class ones.
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user