Click the green flag to run the script pictured. Then press space to generate random values of n. Read the notes and credits for more info.
I was playing Crusade (https://scratch.mit.edu/projects/67967240/), a really fun game by @b00k_w0rm, when I noticed a glitch that allowed one of the stats to be over-upgraded. I looked at the scripts, and everything seemed fine... but then I started getting suspicious about the values reported by the "costume #" variable. This led me to discover an issue related to the small errors that occur when doing math with decimals. If I tell a sprite to switch to costume n, where n is slightly smaller than a round number, the costume will switch to that corresponding to the nearest integer, but the costume # that is reported will round DOWN to the nearest integer! This means you can end up with the costume number not matching the actual costume.