When Loaming Shaman enters the battlefield, target player shuffles any number of target cards from their graveyard into their library.
If Loaming Shaman’s triggered ability targets a player but doesn’t target any cards in that player’s graveyard, that player just shuffles their library.
If the target cards become illegal targets, the target player shuffles their library. If the target player becomes an illegal target, Loaming Shaman’s ability has no effect.