A random code generator, comprising: a power circuit for providing a supply voltage (Vs) to a node, wherein the power circuit is a limited-current circuit, wherein a current to be transmitted to the node is clamped to a preset current range by the limited-current circuit; a differential cell array comprising plural differential cells, wherein each differential cell comprises two sub-cells, a first terminal of the differential cell array is connected with the node through a control line, a second terminal of the differential cell array is connected with a word line, a third terminal of the differential cell array is connected with a first bit line, and a fourth terminal of the differential cell array is connected with a second bit line; a voltage detector connected with the node for detecting a node voltage (Va) of the node; a read/write circuit connected with the first bit line and the second bit line; and a control circuit connected with the word line, the power circuit, the voltage detector and the read/write circuit, wherein the power circuit comprises: a voltage source for outputting the supply voltage (Vs); and a charging circuit comprising a switch and a capacitor, wherein a first terminal of the switch is configured to receive the supply voltage (Vs), a second terminal of the switch is connected with the node, the capacitor is connected with the node, and the node is connected with the control line, wherein during enrollment, the switch of the power circuit is configured to be closed for a short time period and then opened, so that the supply voltage (Vs) is charged to the capacitor and provided to the control line, the read/write circuit is configured to provide a ground voltage to the first bit line and the second bit line, and the control circuit is configured to provide a select voltage to the word line to enroll a selected differential cell of the differential cell array, so that one of the two sub-cells is programmed to an on state, and the other of the two sub-cells is subjected to a program inhibition and in an off state, wherein if a descending slope of the node voltage (Va) is not higher than a predetermined descending slope, the switch is configured to be closed for the short time period again and then opened, so that the supply voltage (Vs) is charged to the capacitor again, wherein the read/write circuit is configured to judge a storage state of the selected differential cell and determines a bit of a random code according to the storage state of the selected differential cell. a power circuit for providing a supply voltage (Vs) to a node, wherein the power circuit is a limited-current circuit, wherein a current to be transmitted to the node is clamped to a preset current range by the limited-current circuit; a differential cell array comprising plural differential cells, wherein each differential cell comprises two sub-cells, a first terminal of the differential cell array is connected with the node through a control line, a second terminal of the differential cell array is connected with a word line, a third terminal of the differential cell array is connected with a first bit line, and a fourth terminal of the differential cell array is connected with a second bit line; a voltage detector connected with the node for detecting a node voltage (Va) of the node; a read/write circuit connected with the first bit line and the second bit line; and a control circuit connected with the word line, the power circuit, the voltage detector and the read/write circuit, wherein the power circuit comprises: a voltage source for outputting the supply voltage (Vs); and a charging circuit comprising a switch and a capacitor, wherein a first terminal of the switch is configured to receive the supply voltage (Vs), a second terminal of the switch is connected with the node, the capacitor is connected with the node, and the node is connected with the control line, wherein during enrollment, the switch of the power circuit is configured to be closed for a short time period and then opened, so that the supply voltage (Vs) is charged to the capacitor and provided to the control line, the read/write circuit is configured to provide a ground voltage to the first bit line and the second bit line, and the control circuit is configured to provide a select voltage to the word line to enroll a selected differential cell of the differential cell array, so that one of the two sub-cells is programmed to an on state, and the other of the two sub-cells is subjected to a program inhibition and in an off state, wherein if a descending slope of the node voltage (Va) is not higher than a predetermined descending slope, the switch is configured to be closed for the short time period again and then opened, so that the supply voltage (Vs) is charged to the capacitor again, wherein the read/write circuit is configured to judge a storage state of the selected differential cell and determines a bit of a random code according to the storage state of the selected differential cell.