(math mt-random) raises an error on multi thread use

Create issue
Issue #212 resolved
Takashi Kato repo owner created an issue

This occasionally throws an error

(import (rnrs) (math) (math mt-random) (srfi :18) (sagittarius control))

(define prng (pseudo-random MT))
(define bytes '(256 256 256 256))

(define threads
  (map (lambda (n)
     (make-thread
      (lambda () (dotimes (i n) (read-random-bytes prng n))))) bytes))

(map thread-join! (map thread-start! threads))

The error just indicates an index out of bound. It should throw no error even if the prng returns the same value.

Comments (1)

  1. Log in to comment