From 2f2e04ca4530c4d62cc06a33bc4cde602f6fde2d Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sat, 27 Jul 2013 13:28:20 -0700 Subject: [PATCH] random.windows: Saw in the pastebin that some Windows installs still don't start with this code. Just set the system and secure RNGs to f, and calling them will throw an error. The Mersenne Twister is still the default anyway. --- basis/random/windows/windows.factor | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/basis/random/windows/windows.factor b/basis/random/windows/windows.factor index 0bf08b7878..29f46dd51d 100755 --- a/basis/random/windows/windows.factor +++ b/basis/random/windows/windows.factor @@ -46,8 +46,12 @@ M: windows-crypto-context random-bytes* ( n windows-crypto-context -- bytes ) handle>> swap [ ] [ ] bi [ CryptGenRandom win32-error=0/f ] keep ; -: try-crypto-providers ( seq -- windows-crypto-context ) - [ first2 ] attempt-all ; +! Some Windows installations still don't work, so just set +! system and secure rngs to f +: try-crypto-providers ( seq -- windows-crypto-context/f ) + [ + [ first2 ] attempt-all + ] [ 2drop f ] recover ; [ {