Also the other trades you can do.
A Pokemon's shinyness is determined the moment it's generated (along with it's IVs, Nature and other characteristics), like when you encounter it in tall grass or via interaction (legendaries). Pokemon that you trade for in-game always have the same pre-set values. In Gigalith's case we know it will always have an Adamant nature, therefor we know that it's stats are randomly generated when you trade for it.