fix random dungeon algorithm