Skip to content
This repository was archived by the owner on Nov 4, 2023. It is now read-only.

Commit bd45e87

Browse files
author
Joshua Li
committed
fix: generate inside the kana range
1 parent 3564c7f commit bd45e87

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ fn rand_kana() -> u32 {
3232
// on the target platform.
3333

3434
let ptr = Box::into_raw(Box::new(0));
35-
let ret = KANA_LO + ((ptr as u32) % 255);
35+
// KANA_HI is 0x30FF. 0x30FF - 0x30A0 = 95.
36+
let ret = KANA_LO + ((ptr as u32) % 95);
3637

3738
// Tell rust that it can clean up this Box.
3839
// XXX: actually, if we do this, rust will tend to allocate the same memory

0 commit comments

Comments
 (0)