Pharrell Williams writes his best music in the shower.

The chart-topping 'Get Lucky' hitmaker feels most inspired when he's standing under a flow of running water or sitting on an aeroplane because the background noises help him focus.

He explained to The Times magazine: ''It's sensory deprivation. Your ears are occupied by the constant sound of water, so it allows your mind to just sort of wander. Or when I'm on a plane. The constant 'shhhhhh' of the air. The next thing you know, lyrics come to me or a beat comes to me.''

The 40-year-old star compares his unusual approach to the free-association ''thought experiments'' Einstein and LEONARDO DA VINCI practised, and says many of his fellow hip-hop artists use the same method.

Pharrell quipped: ''We call it 'tapping in'. Jay Z, when he listens to music, he starts mumbling to himself. But before you know it, he has 16 bars of something that is nothing short of Greek philosophy.''

The musician - who has worked with everyone from Robin Thicke to Britney Spears - believes it was his ''destiny'' to become famous because it must have been fate that renowned producer Teddy Riley relocated his studio to Pharrell's hometown of Virginia Beach when he was 17.

He said: ''I've been sort of realising that there has been a destiny for me. I mean, Teddy moved his studio five minutes from my school. And when I was 17. Not last year. Not the year I was born, or when I was 30, but in my formative years.

''Everything in my life has been like that. All this time I've been going along thinking I'm making my own decisions. But it wasn't until I looked back over my shoulder that I realised it was all destiny.

''I know that God has given me something. A gift. Or if you don't believe in god and just believe in the universe, then this gift is because of the intense mathematics of existence. Everything is numbers.''