If you're installing a whole new flange, use the standard rough-in distance of 12 and get a toilet with a 12 rough-in. If the flange is already there and it's less than 12 away from the wall and you don't want to move it, use whatever toilet will fit or install an offset flange.