Hunting items are divided into 11 groups in each stage.
Group 0: Item #2 (or B, as the game calls it) locations that are visible in the open. There are 8 slots allotted to such locations.
Group 1: Item #1 (C) locations out in the open--since 1 is generally supposed to be easier to find, there are 24 slots for this.
Group 2: Item #2 in a concealed location, such as inside a box or other breakable item. 8 slots.
Group 3: Item #1 in a concealed location. 8 slots.
Group 4: Item #3 (A), usually in a place where you have to dig for it. In Wild Canyon and Dry Lagoon, the player isn't expected to have their dig upgrade; in Security Hall there are no persistent diggable surfaces whatsoever. For these three stages, group 4 is simply filled with assorted locations. In the other stages, there's a special mask on group 4 (as well as group 5) such that even if you can get out of bounds and touch the item's physical coordinates in a glide, it fails to register unless you're actually in the process of digging. 16 slots.
Group 5: Item #2 in a diggable location, with the same proviso that applies to group 4. 16 slots.
Group 6: More diggable locations for item #3, but these are pointless for most TAS purposes since they're reserved for 2-player mode. Group 6 replaces group 8 during 2-player games, since they don't want to make that mode too hard for casual players who also have to worry about the other player launching special attacks. 8 slots.
Group 7: Item #3 that doesn't stay in one place, but rather moves along a path. 8 slots.
Group 8: Item #3 in a difficult location to reach (relatively speaking), such as one that's over a void so as to provide very little frame of reference to pinpoint its position, or one that's in close proximity to hazards such as spike balls or fire. 8 slots.
Group 9: The preset locations for hard mode. 3 slots.
In addition, the enemies are a group, but since they don't use the same object ID as the others, there's no group number to unify them. Nonetheless, certain enemies have flags set to make them a candidate for receiving item #1 or #2, to be released automatically on destruction. The number of slots for this can vary; Pumpkin Hill reserves only 2, while Security Hall reserves 14 of these (but only uses 13).
The actual placement routine goes something like this:
-Did the player already collect item #1 on a previous life (without having used the Restart menu option since)? If so, keep track of the location they collected that. Otherwise, pick a random location out of groups 1, 3, and the enemy group.
-Did the player already collect item #2? If so, keep track of that location. Otherwise, pick a random location out of groups 0, 2, 5, and the enemy group. If this location is close enough to the location for item #1, throw it away and repeat this step--such a location is said to be "locked out". Keep trying until they're far enough apart.
-Did the player already collect item #3? If so, keep track of that location, not that it matters for much. Otherwise, pick a random location out of groups 4, 7, and 8 (replace 8 with 6 if it's 2P mode, and if this is the first run though Pumpkin Hill or Egg Quarters, select only from group 4. This makes sure that the player will have to collect their dig upgrade in order to proceed beyond this level.) If the location is close enough to the location for item #2 (and possibly also for #1 as well), throw it away and repeat this step. Keep trying until they're far enough apart.
Unlike the original Sonic Adventure (and DX), uncollected item locations are rerolled after each loss of life, making it possible to keep restarting until the closest location for #3 comes up, collect it, then keep dying until the closest #2 comes up (once you have an item in hand, you have to die rather than restart or else you lose that progress), and again for #1 which isn't subject to any lockouts. Ideally for a TAS you should be able to manipulate the random generator on the fly to get all three hits on consecutive lives. If for some reason you want to attempt mission 4, note that the no-checkpoint rule applies there even for hunting stages, making any death indistinguishable from a restart. Speedrunning 4s involves having to roll all three pieces at once, and then from the 30,000-odd configurations that are okay by the lockout rule, hoping to manipulate the single fastest one.
The one thing I don't have, preventing the above analysis for being complete enough for TAS purposes, is a reliable metric for "far enough apart". I don't think a simple distance measurement will suffice, since I've observed lockouts at Meteor Herd that cover such a distance that if you applied it to a place like Security Hall, it would likely disqualify the entire stage. I've looked through dumps of all the object definition files, and don't see anything that sticks out as a possible flag for specifying which subsequent locations would be locked out by this one. However, I do see a vague sense of ordering to the items in each group--in Death Chamber, for instance, the locations in and around the red room have the lowest IDs within each group, followed by the blue room, then the green room, pyramid core, and the unaligned hallways and secret rooms after that. So there could be some kind of rule that locks out based on item ID, except that the items aren't uniformly distributed across all the noticeable zones, and assigning the enemy locations (with their varying numbers per stage) to zones doesn't seem feasible at all without hard-coding them as flags in whatever bits are left unused from setting their characteristics as...you know, enemies.
Is disassembling executables of this magnitude into a readable state going to be at all feasible any time soon? Because I can't imagine it would be.