From 5d353c67d831ba1a36c63c51eaafa8e1aa7d790a Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Thu, 8 Nov 2018 02:12:36 +0000 Subject: [PATCH] Mind my i's and j\s. --- src/runtime/random.scm | 4 ++-- tests/runtime/test-random.scm | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/runtime/random.scm b/src/runtime/random.scm index cadd32499..f79374b78 100644 --- a/src/runtime/random.scm +++ b/src/runtime/random.scm @@ -261,8 +261,8 @@ USA. (chacha20-core bytes (fix:* i 64) nonce key chacha-const) (let loop ((j 0) (t 1)) (if (fix:< j 8) - (let ((t (fix:+ t (bytevector-u8-ref nonce i)))) - (bytevector-u8-set! nonce i (fix:and t #xff)) + (let ((t (fix:+ t (bytevector-u8-ref nonce j)))) + (bytevector-u8-set! nonce j (fix:and t #xff)) (loop (fix:+ j 1) (fix:lsh t -8)))))) (let* ((rem (fix:- n (fix:* n/64 64)))) (if (fix:positive? rem) diff --git a/tests/runtime/test-random.scm b/tests/runtime/test-random.scm index 19dedf16c..242380b68 100644 --- a/tests/runtime/test-random.scm +++ b/tests/runtime/test-random.scm @@ -60,9 +60,7 @@ USA. (define-test 'random-bytevector-large (lambda () - (assert-error - (lambda () - (assert-= (bytevector-length (random-bytevector 1088)) 1088))))) + (assert-= (bytevector-length (random-bytevector 1088)) 1088))) (define (define-random-test name procedure) (define-test name -- 2.25.1