|
trivial random ports for deterministic seeding Peter McGoron (31 May 2026 16:58 UTC)
|
||
|
Re: trivial random ports for deterministic seeding
Shiro Kawai
(31 May 2026 18:12 UTC)
|
||
|
Re: trivial random ports for deterministic seeding
Vincent Manis (he/him)
(31 May 2026 18:30 UTC)
|
||
|
Re: trivial random ports for deterministic seeding
Wolfgang Corcoran-Mathe
(01 Jun 2026 00:11 UTC)
|
||
|
(missing)
|
||
|
Re: trivial random ports for deterministic seeding
Wolfgang Corcoran-Mathe
(01 Jun 2026 02:50 UTC)
|
||
|
Re: trivial random ports for deterministic seeding
John Cowan
(01 Jun 2026 06:25 UTC)
|
||
|
Re: trivial random ports for deterministic seeding
Peter McGoron
(01 Jun 2026 11:55 UTC)
|
||
|
Re: trivial random ports for deterministic seeding
Wolfgang Corcoran-Mathe
(02 Jun 2026 00:29 UTC)
|
||
|
Re: trivial random ports for deterministic seeding
Wolfgang Corcoran-Mathe
(01 Jun 2026 00:14 UTC)
|
||
|
Re: trivial random ports for deterministic seeding
Peter McGoron
(01 Jun 2026 00:39 UTC)
|
||
|
Re: trivial random ports for deterministic seeding
Peter McGoron
(01 Jun 2026 00:52 UTC)
|
||
I've added a "trivial" random port in my CHICKEN implementation of the
current draft: <https://codeberg.org/phm/srfi-271-egg>
The trivial random port cyclically repeats an input bytevector. It can
be used to deterministically seed other random ports, and a long-enough
bytevector sourced from /dev/random can be used as a seed in most cases.
Example:
(import (scheme base)
(prefix (srfi 271 determinized trivial) tr:)
(prefix (srfi 271 determinized) det:))
(define seed #u8(1 2 3 4))
(define port (tr:make-random-port seed))
(read-bytevector port 4) ⇒ #u8(1 2 3 4)
(read-u8 port) ⇒ 1
(read-bytevector port 10) ⇒ #u8(2 3 4 1 2 3 4 1 2 3)
(define state (tr:random-port-state port))
(define new-port (tr:make-random-port state))
(read-bytevector new-port 5) ⇒ #u8(4 1 2 3 4)
(read-bytevector port 5) ⇒ #u8(4 1 2 3 4)
(define some-other-random-algorithm-port
(det:make-random-port port))
;; Will work except in pathological cases.
;; A 128 byte seed from a very random source like /dev/random
;; will likely be sufficient for all practical cases.
-- Peter McGoron