A photonic integrated circuit, PIC, for use in generating a random number, comprising: a light source on a substrate; a light splitter (10a, 10b) configured to split light from the light source into a first portion of light and a second portion of light; a first light detector on the substrate configured to, in response to receipt of the first portion of light, output a first electrical signal for use in generating the random number; a light guidance system on the substrate configured to direct the first portion of light to the first light detector; a second light detector on the substrate, configured to receive the second portion of light, for monitoring the intensity of light output by the light source to detect deviation from a target intensity; and circuitry configured to: i) receive, an electrical signal output by the second light detector and based on the second portion of light; ii) determine a magnitude of the electrical signal output by the second light detector, the magnitude indicative of the intensity of light output by the light source; iii) determine, based on the magnitude, that the intensity of light output by the light source is different from the target intensity; and in response to iii), at least one of: iv) adjust a current applied to the light source to adjust the intensity of light output by the light source, to reduce a difference between the intensity of light output by the light source and the target intensity; or v) calibrate, on the basis of a difference between the intensity of light output by the light source and the target intensity, a process for generating the random number. a light source on a substrate; a light splitter (10a, 10b) configured to split light from the light source into a first portion of light and a second portion of light; a first light detector on the substrate configured to, in response to receipt of the first portion of light, output a first electrical signal for use in generating the random number; a light guidance system on the substrate configured to direct the first portion of light to the first light detector; a second light detector on the substrate, configured to receive the second portion of light, for monitoring the intensity of light output by the light source to detect deviation from a target intensity; and circuitry configured to: i) receive, an electrical signal output by the second light detector and based on the second portion of light; ii) determine a magnitude of the electrical signal output by the second light detector, the magnitude indicative of the intensity of light output by the light source; iii) determine, based on the magnitude, that the intensity of light output by the light source is different from the target intensity; and in response to iii), at least one of: iv) adjust a current applied to the light source to adjust the intensity of light output by the light source, to reduce a difference between the intensity of light output by the light source and the target intensity; or v) calibrate, on the basis of a difference between the intensity of light output by the light source and the target intensity, a process for generating the random number. i) receive, an electrical signal output by the second light detector and based on the second portion of light; ii) determine a magnitude of the electrical signal output by the second light detector, the magnitude indicative of the intensity of light output by the light source; iii) determine, based on the magnitude, that the intensity of light output by the light source is different from the target intensity; and iv) adjust a current applied to the light source to adjust the intensity of light output by the light source, to reduce a difference between the intensity of light output by the light source and the target intensity; or v) calibrate, on the basis of a difference between the intensity of light output by the light source and the target intensity, a process for generating the random number.