diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-07-13 21:08:35 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-07-13 21:08:35 -0700 |
commit | 6a5488b1d3966452daa4f6d1f025bc22f4b02566 (patch) | |
tree | 16d9382c73d53f9cf16db5afc9911d6abd194861 /tests/013/rand.tl | |
parent | 1667fea9832ce1101eb69e2c8a38834457144586 (diff) | |
download | txr-6a5488b1d3966452daa4f6d1f025bc22f4b02566.tar.gz txr-6a5488b1d3966452daa4f6d1f025bc22f4b02566.tar.bz2 txr-6a5488b1d3966452daa4f6d1f025bc22f4b02566.zip |
rand: support buffers as random seeds.
* rand.c (make_random_state): Recognize buffer object as
sources of bits for seeding.
* tests/013/rand.tl: New file.
* txr.1: Documented.
Diffstat (limited to 'tests/013/rand.tl')
-rw-r--r-- | tests/013/rand.tl | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/tests/013/rand.tl b/tests/013/rand.tl new file mode 100644 index 00000000..f593c39c --- /dev/null +++ b/tests/013/rand.tl @@ -0,0 +1,84 @@ +(load "../common") + +(mtest + (random-state-get-vec (make-random-state #b'' 0)) + #(740765398 1304255849 3309840409 338361566 4155223728 1162561521 + 4236628653 446542199 639181595 1801947880 2890206840 2695457564 + 2292665861 3251351234 2171649709 704313206 0) + (random-state-get-vec (make-random-state #b'FF' 0)) + #(4278190080 1304255849 3309840409 338361566 4155223728 1162561521 + 4236628653 446542199 639181595 1801947880 2890206840 2695457564 + 2292665861 3251351234 2171649709 704313206 0) + (random-state-get-vec (make-random-state #b'FFFF' 0)) + #(4294901760 1304255849 3309840409 338361566 4155223728 1162561521 + 4236628653 446542199 639181595 1801947880 2890206840 2695457564 + 2292665861 3251351234 2171649709 704313206 0) + (random-state-get-vec (make-random-state #b'FFFFFF' 0)) + #(4294967040 1304255849 3309840409 338361566 4155223728 1162561521 + 4236628653 446542199 639181595 1801947880 2890206840 2695457564 + 2292665861 3251351234 2171649709 704313206 0) + (random-state-get-vec (make-random-state #b'FFFFFFFF' 0)) + #(4294967295 1304255849 3309840409 338361566 4155223728 1162561521 + 4236628653 446542199 639181595 1801947880 2890206840 2695457564 + 2292665861 3251351234 2171649709 704313206 0) + (random-state-get-vec (make-random-state #b'FFFFFFFFFF' 0)) + #(4294967295 4278190080 3309840409 338361566 4155223728 1162561521 + 4236628653 446542199 639181595 1801947880 2890206840 2695457564 + 2292665861 3251351234 2171649709 704313206 0) + (random-state-get-vec (make-random-state (make-buf (* 4 16) #xff) 0)) + #(4294967295 4294967295 4294967295 4294967295 4294967295 4294967295 + 4294967295 4294967295 4294967295 4294967295 4294967295 4294967295 + 4294967295 4294967295 4294967295 4294967295 0) + (random-state-get-vec (make-random-state (make-buf (* 5 16) #xff) 0)) + #(4294967295 4294967295 4294967295 4294967295 4294967295 4294967295 + 4294967295 4294967295 4294967295 4294967295 4294967295 4294967295 + 4294967295 4294967295 4294967295 4294967295 0)) + +(mtest + (random-state-get-vec (make-random-state 0 0)) + #(740765398 1304255849 3309840409 338361566 4155223728 1162561521 + 4236628653 446542199 639181595 1801947880 2890206840 2695457564 + 2292665861 3251351234 2171649709 704313206 0) + (random-state-get-vec (make-random-state #xFF 0)) + #(255 1304255849 3309840409 338361566 4155223728 1162561521 4236628653 + 446542199 639181595 1801947880 2890206840 2695457564 2292665861 + 3251351234 2171649709 704313206 0) + (random-state-get-vec (make-random-state #xFFFF 0)) + #(65535 1304255849 3309840409 338361566 4155223728 1162561521 4236628653 + 446542199 639181595 1801947880 2890206840 2695457564 2292665861 + 3251351234 2171649709 704313206 0) + (random-state-get-vec (make-random-state #xFFFFFF 0)) + #(16777215 1304255849 3309840409 338361566 4155223728 1162561521 + 4236628653 446542199 639181595 1801947880 2890206840 2695457564 + 2292665861 3251351234 2171649709 704313206 0) + (random-state-get-vec (make-random-state #xFFFFFFFF 0)) + #(4294967295 1304255849 3309840409 338361566 4155223728 1162561521 + 4236628653 446542199 639181595 1801947880 2890206840 2695457564 + 2292665861 3251351234 2171649709 704313206 0) + (random-state-get-vec (make-random-state #xFFFFFFFFFF 0)) + #(4294967295 255 3309840409 338361566 4155223728 1162561521 4236628653 + 446542199 639181595 1801947880 2890206840 2695457564 2292665861 + 3251351234 2171649709 704313206 0) + (random-state-get-vec (make-random-state (expt 2 (* 8 4 16)) 0)) + #(740765398 1304255849 3309840409 338361566 4155223728 1162561521 + 4236628653 446542199 639181595 1801947880 2890206840 2695457564 + 2292665861 3251351234 2171649709 704313206 0) + (random-state-get-vec (make-random-state (pred (expt 2 (* 8 4 16))) 0)) + #(4294967295 4294967295 4294967295 4294967295 4294967295 4294967295 + 4294967295 4294967295 4294967295 4294967295 4294967295 4294967295 + 4294967295 4294967295 4294967295 4294967295 0) + (random-state-get-vec (make-random-state (pred (expt 2 (* 8 4 17))) 0)) + #(4294967295 4294967295 4294967295 4294967295 4294967295 4294967295 + 4294967295 4294967295 4294967295 4294967295 4294967295 4294967295 + 4294967295 4294967295 4294967295 4294967295 0)) + +(mtest + (random-state-get-vec (make-random-state + #(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0))) + #(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) + (random-state-get-vec (make-random-state + #(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17))) + #(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17) + (random-state-get-vec (make-random-state + #(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17) 10)) + #(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17)) |