How are unseeded players, players with protected ranking, qualifiers and wildcards positioned in a Grand Slam singles main draw? Is it a generic random allocation or is it based on a formula/method specific to each Grand Slam?
Yes, random allocation.
See the following section in the official ITF Grand Slam rulebook (note that Wild Cards may be seeded):
Z. ENTRY PROCEDURES / 2. Singles Main Draw / g. Method of Draw
g. Method of Draw A draw sheet for 128 places will be used. The placement of seeds as heretofore provided. The remaining players, including the Qualifiers, will be drawn and placed into the vacant spaces in the draw, beginning at the top of the draw.