aboutsummaryrefslogtreecommitdiff
path: root/tk-random.h
diff options
context:
space:
mode:
Diffstat (limited to 'tk-random.h')
-rw-r--r--tk-random.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/tk-random.h b/tk-random.h
index d559659..b2ff296 100644
--- a/tk-random.h
+++ b/tk-random.h
@@ -22,7 +22,10 @@
uint8_t pgm_rand() {
static uint16_t offset = 255;
- offset = (offset + 1) & 0x3ff | 0x0100;
+ // loop through ROM space, but avoid the first 256 bytes
+ // because the beginning tends to have a big ramp which
+ // doesn't look very random at all
+ offset = ((offset + 1) & 0x3ff) | 0x0100;
return pgm_read_byte(offset);
}