Randomly smelling pee can be a result of phantosmia which is the perception of smelling things that are not really there.
Things that can cause phantosmia or smelling pee randomly can be a result of allergies, upper respiratory infections, colds, head injuries, aging, trauma, inflamed sinuses, temporal lobe seizures, brain tumors, certain medicines and even Parkinson's disease.
If you have not illness it could be that there may be some urine somewhere around you that you're not aware of.
Or if you use ammonia to clean with that too can smell like pee.
A Covid infection can also cause you to smell pee and mess with your sense of smell.
There may also be rat urine or mice urine or pet urine around your house if you have pets.
You might also have bacteria in your nose and cleaning your nose out can help sometimes.
I once was smelling urine and I kept smelling it even when I was outside.
I then found out that it was the inside of nose smelling like urine.
I took a cotton swab and dipped it in some hydrogen peroxide and swabbed the inside of my nose gently to clean it.
The smell then went away but sometimes it's just smelling things that are not really there.