yellowstonegames / SquidLib

Useful tools for roguelike, role-playing, strategy, and other grid-based games in Java. Feedback is welcome!
Other
448 stars 46 forks source link

RNG getRandomUniqueCells returning out of bound Coord values #171

Closed SquidPony closed 7 years ago

SquidPony commented 7 years ago

With this code for (Coord coord : rng.getRandomUniqueCells(0, 0, map.width, map.height)) System.out.println("Testing map (" + map.width + ", " + map.height + ") found Coord: " + coord);

I'm getting this output Testing map (100, 50) found Coord: (45,83)

My theory is that x and y are swapped somewhere

tommyettinger commented 7 years ago

Good catch! Writing some tests now. I think I found what's causing the bug (you're probably right, it seems to have mixed up % and / for x and y), and I want to verify.