I have been trying to write a random number generator using the hardware of the phone. After reading other people's attempts and tried some. I came up with the following to generate the seed:

  • Play a short pre-recorded white-noise on the phone's speaker.
  • The mic gets the feedback, which then gets mixed in the playback audio.
  • This should create a continuous white-noise output.

This can be done at program start and feeds into a PNG. What do you think?

  • Why do you need to play white noise in this case?
    – Nic Barker
    Aug 31, 2015 at 9:10
  • To kick start the speak-mic-speak loop process. Aug 31, 2015 at 12:18
  • I'm just wondering why white noise would give you more of a random input than simply recording the background noise as-is, that's all.
    – Nic Barker
    Aug 31, 2015 at 12:29
  • I assumed the phone was in a silent environment. A short white noise is necessary to start the process. The physical characteristic of the device and the environment it is in creates randomness. Aug 31, 2015 at 13:12
  • 1
    Have you already compared your PRNG with phone's standard PRNG?
    – ott--
    Aug 31, 2015 at 17:35

2 Answers 2


Without lots of research and public scrutiny, home crypto tends to be very vulnerable to many attacks. You will do better using your phone's secure PRNG.


I think that depending on how you are mixing before you output the noise to the speaker you will be begging for audio feedback, which will ramp up to output a constant hum, and will not be very random when you sample it again.

Here is some links to the sounds of Acoustic feedback vs white noise, white noise has no pattern to it but the audio feedback does have repeatable patterns which would be noticeable if you were sampling and making numbers from:



With that in mind you might as well record silence and hope the slight variations in your system would give you some entropy for your number generation. Or use the phones camera while its out of focus and blurry, and only sample the lowest significant bits.

  • Now you have a kick-butt answer
    – schroeder
    Mar 27, 2017 at 14:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .