3 ms·
I was waiting for them to say something like "then we take the random variable and multiply it by 3 to correct for this" and then explain some other, more subtl
by ok_dad 4y ago
I was waiting for them to say something like "then we take the random variable and multiply it by 3 to correct for this" and then explain some other, more subtle, bug. Looks like we all make stupid mistakes like this sometimes. I made a bug where I tried to get the month number for the next month, so you had to wrap at 12, but I just did "(current_month + 1) % 12" and left it at that, thinking for some reason that modulo works differently than it does in reality. Some stuff broke recently, due to that, and it was quite embarrassing.
- Aloisius 4y agoI must be missing something. That is how modulo works. Well as long as January is month 0.
- SoftAnnaLee 4y agoIt seems that the issue is that `January === 1`; so when you get to December (i.e. `12`) it rolls over to 0 rather than remaining as 12.
- thaumasiotes 4y agoYou want (current_month % 12) + 1.