Well, not all % are the same %. Personally I prefer to create my own counters. For example, if I need 25%, I make a counter from #00 to #03, and use #00 value for 25% chance. That way I'm sure that I will definitely get those 25% every 4 frames.
But if I do AND #03 on some random value, then I also get 25% chance from #00, but statistically it can be proved only by a large number of tryouts, coz it's not guaranteed that I will recieve #00 after AND within every 4 frames.
If I wanted to get 30%, I would make a #00-#09 counter and check for #00-#02, or better yet, make a check for 3 constant values with a similar interval between them, like #00, #03 and #06, in case I really wanted to calm my meticulous brain down
Also, #77 is not 30%. #77 = 119 (120 if we take 0 into account as well). So 120 / 256 * 100% = 46%
I guess you've meant #4D (77, well, 78 in case with RNG), then it's correct for checking on #00-#4C.
September 30, 2019, 05:21:02 am - (Auto Merged - Double Posts are not allowed before 7 days.)
Here is an idea. FCEUX has a "random RAM initialization" option. Click on that, then pause emulator, open any ROM and run this code in Debugger.
Do a Reset while still being paused, then try again. See for yourself if it's really about 30% every time