How can I sample the solar spectrum to determine, in the vacuum of space, the frequency of a random photon?

I am working on improving a spacecraft charging model by simulating the photoelectric effect. To do so I need to determine the frequency of a random photon coming from the sun. How would I go about doing this?

My naive approach would be to simply select a random frequency from the solar spectrum, but is this physical?

• The photon has energy = hν where ν is the frequency of the light it is a part of. h the Planck constant – anna v Nov 1 at 13:02
• Get solar spectrum or use a black body at appropriate temperature. Convert to photon flux vs wavelength. Figure appropriate method to pick a ‘random’ photon. I’d likely truncate the spectrum below the energy needed to generate a photo electron. – Jon Custer Nov 1 at 13:09
• @JonCuster this sounds like exactly what I need! If i have the solar irradiance vs frequency, how would I go about converting to photon flux? Once I have the flux, I suppose I can just normalize the frequency from 0 to 1, and pick the cutoff frequency as my probability for the photon having enough energy to create photoelectrons? – Cumulus Nov 1 at 13:21
• Planck's law (en.wikipedia.org/wiki/…) gives you power vs wavelength. Divide by energy per photon at wavelength to get number of photons per unit wavelength. Note that the distribution is not simple, making how you pick your 'random' photon a bit harder than it looks at first glance. – Jon Custer Nov 1 at 13:27
• @JonCuster, just to see if I understand you. The power curve is skewed, so the probability of sampling a higher energy photon is higher than if the power curve was flat. Correct? – Cumulus Nov 1 at 13:42