ashinn / chibi-scheme

Official chibi-scheme repository
Other
1.23k stars 141 forks source link

random-source-state-ref failes #223

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
ponk% ./chibi-random-state.scm
ERROR on line 9 of file ./chibi-random-state.scm: string-index->offset: index 
out of range: 128
  called from <anonymous> on line 1039 of file /usr/local/share/chibi/init-7.scm
  called from <anonymous> on line 542 of file /usr/local/share/chibi/init-7.scm
  called from <anonymous> on line 622 of file /usr/local/share/chibi/init-7.scm

Original issue reported on code.google.com by seth.al...@gmail.com on 28 May 2014 at 12:45

Attachments:

GoogleCodeExporter commented 9 years ago
Yuck - I'll change the random state to be a bytevector to avoid these problems.

Original comment by alexsh...@gmail.com on 28 May 2014 at 2:09

GoogleCodeExporter commented 9 years ago
Fixed.  Note however that the random_r interface on Linux
doesn't seem to make saving and restoring state possible,
as initstate_r requires resetting with a seed, which is not
the same as setting the seed, generating some numbers,
and then setting just the random state.

You can reliably use random-source-pseudo-randomize!
with the same arguments for determinism.  Is there any
reason you need to use random-source-state-ref/set!
instead of this?

Original comment by alexsh...@gmail.com on 28 May 2014 at 2:30

GoogleCodeExporter commented 9 years ago
No good reason -- I was trying to get srfi-27's conftest.scm to run to 
completion for srfi-27 mashed into an r7rs library.

Original comment by seth.al...@gmail.com on 28 May 2014 at 2:43