Main Menu
Main Page
New pages
Recent changes
Random page

Arbitrary code execution
Pokémon cloning
Pomeg glitch and Glitzer Popping
Tweaking and voiding
Glitches by generation
Other glitch categories

Disassembly projects
The Big HEX List
Interactive tools
Reference documents

Legendary Star Blob 2 (Hakuda) (日本語/Japanese)
Pokémon Speedruns wiki (English)
PRAMA Initiative (Français/French)
MissingNo. Glitch City (Italiano/Italian)
Become an affiliate!

Site source code

Search Wiki


Search Forums


Author Topic: Gbz80: How to generate a random number between $xx and $yy  (Read 1004 times)

0 Members and 1 Guest are viewing this topic.


  • Member+
  • *
  • Offline Offline
    • View Profile
Gbz80: How to generate a random number between $xx and $yy
« on: October 16, 2017, 07:56:05 am »
I'm making a small ACE game for Pokemon Red. I want a block to be placed at a random x and y value, and due to screen limitations, the x value must be between $00 and $13 (inclusive) and the y value must be between $00 and $11 (also inclusive)

My question is this: Is there any way to make an RNG that is between two different values?


  • The French Lord of Laziness (and a huge The Legend Of Zelda fan)
  • Staff
  • *****
  • Offline Offline
  • Gender: Male
  • Pewter City (B)rocks !
    • View Profile
    • My Little Website
Re: Gbz80: How to generate a random number between $xx and $yy
« Reply #1 on: October 16, 2017, 01:25:38 pm »
`call Random` each time. Far from perfect due to the way the game's RNG is implemented, but it should suffice.
"THOU SHALL NOT PASS !!"  RIVAL's effect, Gandalf.

Proudly glitching Pokémon Red and Yellow on a Black & White GB, Pocket GB, GB Color, GBA SP and new 3DS.

My Twitter (beware, I'm French)
My YouTube (same warning)

Here is an online tool to build 8F setups : GBz80 to Items !

They see me layzin', they ha-tin'...
Heavy contributor of the global augmentation of entropy (my room's is too damn high !)