A random number expanding device (100) is provided with an expanding unit (120) that, using a logic operation obtained by multiplication of one matrix of an M × N sized inspection matrix determined from (N, N-M, D) linear codes for error correction or an M × N sized generator matrix and a vector of which M component comprises a random number r(M), the multiplication having addition as an exclusive OR, expands the random number r(M) to an N-bit random number s(N). Because the random number expanding device (100) is provided with the expanding unit (120), the number of bits of the random number used can be reduced, and multiple beams of laser irradiation attack can be countered.