Simple. Act nervous and walk. There is probably a better way to put it than calling it "walking nervously" but we don't hire police officers for literary skills. We hire them to serve and protect.Please describe as best you can how one walks "nervously"
I got pulled over one night for leaving a parking lot when a police car turned in. I had visited an ATM in the parking lot and stopped at the parking lot exit after the transaction to put my card and money away. He turned in to the lot, I left, he pursued. He thought it was suspicious that I left when he arrived. I suppose we can add that to the long list of "don't do this". Don't walk away from an approaching police officer - even if you don't know he's approaching. (BTW: This was years before 9/11 so it wasn't a terrorism related thing.)
If you ACT in a suspicious manner when you see an officer said officer will begin to wonder what you are hiding. If you are doing nothing wrong you have nothing to fear. Don't waive a red flag in front of a bull ... especially a railroad bull.