It's easy electronically but if you're writing an app for a device/OS that doesn't implement that capability and expose it to apps you're left with either pseudorandom numbers or a sample. A very long losslessly compressed sample can be good but would require a large download, so in practice these apps generally have short, lossily compressed samples. These samples (and the alternative, pseudorandom numbers) sound absolutely awful. A human mind on the verge of sleep is an insanely powerful signal processing device and recogniser/producer/completer of patterns.
Raspberry Pis have hardware random number generators. I use one to generate smoothed brown noise for sleep. It's blissful.
I've been meaning to get round to solving this problem on phones, making an app that can, without a ridiculously large download, generate really high quality sleep noise. I have some ideas but it's not an easy problem.