Main Menu
Main Page
Forums
New pages
Recent changes
Random page
Help

Glitches
Arbitrary code execution
Pokémon cloning
Pomeg glitch
Tweaking
Glitches by generation
Glitch categories

References/Resources
Databases
Disassembly projects
The Big HEX List
Pokémon cheat codes
Pokémon glitch terminology
Useful tools
More

Affiliates
Legendary Star Blob 2 (Hakuda)
Pokémon Speedruns wiki
PRAMA Initiative
Become an affiliate!

Technical
Site source code

Search Wiki

 

Search Forums

 

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

0 Members and 1 Guest are viewing this topic.

Epsilon

  • 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?
grouchy

ISSOtm

  • 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 !)