Patent ID: 7895251

Claim:
A random number generating method for generating a random number expressed by K bits, comprising: using a processor to perform: a mask step of masking an original bit sequence of K bits held in a memory by a first predetermined bit pattern to generate a masked bit sequence; an operation step of making an exclusive-OR operation of the masked bit sequence, and setting a bit value indicating the exclusive-OR operation result to be included in a result obtained by shifting the original bit sequence of K bits held in the memory in a predetermined direction, in order to update the original bit sequence held in the memory; a first inversion control step of controlling inversion/non-inversion of a second predetermined bit pattern depending on whether or not the updated original bit sequence from the operation step matches a bit sequence of a specific pattern; a second inversion control step of controlling inversion/non-inversion of bit values in the updated original bit sequence, which is output from the memory, in accordance with a designated bit value in the second predetermined bit pattern; and an output step of outputting a bit sequence as a processing result in the second inversion control step as a random number expressed by K bits.