aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSelene ToyKeeper2017-03-26 15:18:03 -0600
committerSelene ToyKeeper2017-03-26 15:18:03 -0600
commit651b2c8bdc72364f7602db356f21d2a061f82ebf (patch)
tree07667e2b1b834db0c6db847aa156b3d83513b801
parentMade tk-delay.h allow use of both _delay_ms() and _delay_4ms(). (diff)
downloadanduril-651b2c8bdc72364f7602db356f21d2a061f82ebf.tar.gz
anduril-651b2c8bdc72364f7602db356f21d2a061f82ebf.tar.bz2
anduril-651b2c8bdc72364f7602db356f21d2a061f82ebf.zip
Fixed a compiler warning about 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);
}
If you find this content useful please consider a small donation via bitcoin: bitcoin:1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2?amount=0.001&message=Donation Scraping git contents via cgit is very resource intensive. The continued hosting of these git repositories is entirely financed by your bitcoin contributions. For donations of a least 1 mBTC you include your IP address in the message of your bitcoin donation. This will remove this message in the future for requests from your IP, which will significantly reduce token usage. In any case, any contributions to bitcoin address 1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2 are very welcome. Thanks in advance for you contribution to a self-sustaining ecosystem.