Views: 618,039,040
2 users online: Tob, wEbi - Guests: 60 - Bots: 301Users: 34,304 (1,491 active)
Latest: marioandsonicfan524
Tip: You can use the File Bin to upload screenshots, videos, etc. of your hack.Not logged in.
Details for Better Random Number Generator
SMW Patches - Better Random Number Generator
File Name: Better Random Number Generator
Version History: View
Authors: wiiqwertyuiop
Tool: Asar
Requires Free Space: Yes
Bug Fix: No
Featured: No
Description: This patch will replace SMW's RNG with a faster, shorter, and more random number generator. It will also let you use $148B and $148C as freeram. Requires no freespace (instead it will give you some).

Note: the patch will not work on SA-1 since other things uses it on the SA-1 side as the code uses the PPU registers. However, the template code that includes a custom range is "SA-1-able".
Tags: random
Download: Download - 3.46 KiB
  Submit Update
I get how the ranged RNG works, because integer always truncate the value towards 0, add the fact that at user-defined max, (255*x)/256, would never land exactly at max (say 256), since it exploits the round-down. For example: a maximum of 4 would be (255*5)/256 gives 4.98046875, which truncates to 4, which is the intended maximum. The maximum in a fixed number of bits is 2n-1, while loading the higher bit/word (which is the same as LSR 8 or 16 times) divide by exactly 2n without the -1. The maximum and the division is really close to each other, therefore doing minimal impact to the result compare to my broken one.
Posted by: GreenHammerBro -
@bensalot see description
Posted by: Kiatus -
I'm still really new to hacking. How do you get the custom range to apply to an SA1 rom? I keep getting error messages
Posted by: Bensalot -
Sorry about that.
Posted by: GreenHammerBro -
Thanks god Erik
Posted by: Akaginite -
Did i invade someone's else privacy about metioning someone's name?
Posted by: GreenHammerBro -
Seems okay, however I made some modifications, namely changed ORA to AND, which should allow for lower ranges in some occassions too. Functionality wise it's okay and allows for making manipulation harder, however the only reason this is better than SMW's is because you'll still get a random value even when you enter a new level (the random seeds still get cleared in level load, but by using the latch/HV counters this really has no effect).

Removed Akaginite's name by request.
Posted by: o Erik -
I've lost the run to RNG dude, what!?
Posted by: IanBoy -
Dumb that nintendo cleared the RNG ram, which messes it up and not make it random.
Posted by: GreenHammerBro -

Oh, thanks for telling me that, I often don't look at the already filled entries. The custom range now works with SA-1. If you look in the sa-1 patch, there are multiplication registers you can replace the ppu.
Posted by: GreenHammerBro -
should remove sa-1 tag because this patch doesn't works on sa-1 rom.

... also please remove my name on authors.
Posted by: Akaginite -
Look at the gersion history included. It has better ranged RNG.
Posted by: GreenHammerBro -
What's the difference in this update?
Posted by: kamekku14 -
Yep, my spelling is horrible.
Posted by: GreenHammerBro -
Posted by: o Erik -

The purpose of this site is not to distribute copyrighted material, but to honor one of our favourite games.

Copyright © 2005 - 2018 - SMW Central
Legal Information - Privacy Policy - Link To Us

Total queries: 29


Follow Us On

  • Facebook
  • Twitter
  • YouTube


  • Talkhaus
  • SMBX Community
  • GTx0
  • Super Luigi Bros
  • MFGG
  • Gaming Reinvented