Rejection sampling device and rejection sampling method

The rejection sampling device and method optimize the generation of pseudo-random numbers by rejecting specific bitwise AND results, addressing inefficiencies in existing methods to enhance efficiency in generating random numbers on the field F for a prime number q=2^n - 1.

WO2026239614A1PCT designated stage Publication Date: 2026-11-19NT T INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
PCT/JP2025/017921
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2025-05-16
Publication Date
2026-11-19

AI Technical Summary

Technical Problem

Existing rejection sampling methods, such as QR-UOV, are inefficient for generating random numbers on the field F for a prime number q=2^n - 1, particularly when a large number of random numbers are required.

Method used

A rejection sampling device and method that efficiently generates pseudo-random numbers by rejecting values where the bitwise AND of the pseudo-random number and the prime number q equals q, and using the bitwise AND of other pseudo-random numbers and q for valid outputs, reducing unnecessary calculations and improving efficiency.

Benefits of technology

The proposed method achieves more efficient rejection sampling by minimizing unnecessary bitwise AND operations, thereby enhancing the generation of random numbers on the field F for a prime number q=2^n - 1.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure JP2025017921_19112026_PF_FP_ABST
    Figure JP2025017921_19112026_PF_FP_ABST
Patent Text Reader

Abstract

A rejection sampling device according to an aspect of the present invention samples a sequence of pseudo-random numbers having a length n' (< τ) from a sequence of pseudo-random numbers having a length τ in a uniform distribution of 0-q. The rejection sampling device includes a rejection sampling unit that, when the value vj ∧ q of the bitwise logical product of a j-th (1 ≤ j ≤ n') pseudo-random number vj and q is q, rejects the pseudo-random number vj and sets the value vk ∧ q (where vk ∧ q ≠ q) of the bitwise logical product of a k-th (n' + 1 ≤ k ≤ τ) pseudo-random number vk and q as the value of the pseudo-random number vj.
Need to check novelty before this filing date? Find Prior Art

Description

Rejection Sampling Device and Rejection Sampling Method

[0001] The present disclosure relates to a rejection sampling device and a rejection sampling method.

[0002] Rejection sampling for uniform distributions is known. In particular, rejection sampling that rejects q=2 from {0, 1, ..., 2 n -1} is effective when generating random numbers on the field F for a prime number q=2 n -1. Note that such random numbers can be simply generated by rand%q, but this is inefficient when generating a large number of random numbers. n -1 for a prime number q=2 q

[0003] As a method capable of efficiently generating random numbers on the field F for a prime number q=2 n -1, the rejection sampling adopted in QR-UOV is known (Non-Patent Document 1). q

[0004] "QR-UOV", Internet <URL: https: / / info.isl.ntt.co.jp / crypt / qruov / index.html>

[0005] However, the rejection sampling adopted in QR-UOV may still be inefficient in some cases.

[0006] The present disclosure has been made in view of the above points, and an object thereof is to realize efficient rejection sampling.

[0007] A rejection sampling device according to one aspect of the present disclosure is a rejection sampling device that samples a sequence of pseudo-random numbers of length n' (<τ) from a sequence of pseudo-random numbers of length τ in a uniform distribution from 0 to q inclusive, wherein when the value of the bitwise AND of the j-th (1≦j≦n') pseudo-random number v j and q, v j ∧q, is q, the pseudo-random number v j is rejected, and the value of the bitwise AND of the k-th (n'+1≦k≦τ) pseudo-random number v k and q, v k ∧q (where v k ∧q≠q) is used as the pseudo-random number v​​j It has a rejection sampling unit that sets the value to .

[0008] This enables efficient rejection sampling.

[0009] This figure shows an example of conventional rejection sampling. This figure shows an example of a conventional rejection sampling algorithm. This figure shows an example of the hardware configuration of a rejection sampling device according to one embodiment. This figure shows an example of the functional configuration of a rejection sampling device according to one embodiment. This flowchart shows an example of the operation of a rejection sampling device according to one embodiment. This figure shows an example of rejection sampling according to Embodiment 1. This figure shows an example of a rejection sampling algorithm according to Embodiment 1. This figure shows an example of a rejection sampling algorithm according to Embodiment 2.

[0010] One embodiment of the present invention will be described in detail below with reference to the drawings.

[0011] <Rejection Sampling Used in QR-UOV> In the rejection sampling used in QR-UOV (Non-Patent Literature 1), τ (pseudo) random numbers of the byte string are generated at once (more than the required number of pseudorandom numbers n'), and then q = 2 from these τ random numbers. n After generating random numbers less than or equal to -1, q = 2 n n' random numbers are generated by rejecting the part that is -1 (where n is a predetermined integer greater than or equal to 1). When generating random numbers less than or equal to q, q = 2 n Since it is -1, a non-negative integer less than or equal to q can be generated simply by taking the bitwise logical AND of a 1-byte integer (i.e., an 8-bit integer) and q. Therefore, it is possible to generate n' random numbers more efficiently compared to generating random numbers less than or equal to q using rand%q.

[0012] Figure 1 shows an example of conventional rejection sampling. In Figure 1, as an example, the case where q = 7, n' = 7, and τ = 12 is shown. As shown in Figure 1, in rejection sampling described in Non-Patent Literature 1, (1) the byte string of τbyte is input, (2) a non-negative integer less than or equal to q is generated by taking the bit logical AND of each element with q, and (3) if there is an element whose value is q among the 1st to n'th elements, that element is rejected, and elements whose value is not q are added from an element called a supplementary list.

[0013] The rejection sampling described in Non-Patent Document 1 will be explained in more detail below. Figure 2 is a diagram showing an example of a conventional rejection sampling algorithm. As shown in Figure 2, the rejection sampling algorithm described in Non-Patent Document 1 uses byte string(r 1 , ..., r τ ) ∈ B τ The inputs are the length τ of the byte string and the length n' of the random vector, and the random vector (v 1 , ..., v n' ) ∈ F q n' Outputs r j This is a 1-byte pseudorandom number. Note that τ := τ q,λ (n') (that is, τ is determined by n', q, and λ, where λ is a security parameter).

[0014] In the rejection sampling algorithm shown in Figure 2, v for j = 1, ..., τ j ←r j Random numbers less than or equal to q are generated using ∧q (where ∧ is a bitwise logical AND) (lines 1-3), and k ← n' + 1 (line 4). v j The supplementary list is a list whose elements are (j = n' + 1, ..., τ).

[0015] Next, v k = q and k < τ+1, update k ← k+1 (lines 5-7). As a result, k has elements from the supplementary list, v j The index (value of j) of the first element that is not equal to q is stored here.

[0016] Next, for j = 1, ..., n', perform the following (lines 8 to 19).

[0017] v j = If q and k < τ + 1, then v j ←v k , after setting k←k+1 (lines 9-11), v k = q and k < τ + 1, update k ← k + 1 (lines 12-14). That is, v j v = q j Discard v included in the supplementary list k ≠q as a new v j In addition, the following v from the supplementary list k Select ≠q.

[0018] On the other hand, v j Even if = q, if k ≥ τ + 1 (i.e., if it becomes impossible to select an element from the supplementary list), v j ←Set to 0 (lines 15-16).

[0019] Finally, (v 1 , ..., v n' ) outputs (line 20). This results in q=2 n -1 or less, and v j A random number v such that ≠ q j A random vector (v) whose elements are 1 , ..., v n' ) can be obtained.

[0020] <Challenges of rejection sampling used in QR-UOV> However, in the rejection sampling method used in QR-UOV, when generating non-negative integers less than or equal to q (the second line of the rejection sampling algorithm shown in Figure 2), integers that may not be used within the algorithm are also called and their bitwise AND operation is performed with q. For this reason, it can still be said to be inefficient.

[0021] Therefore, the following describes a rejection sampling device 10 that can achieve more efficient rejection sampling.

[0022] <Example of Hardware Configuration of Rejection Sampling Device 10> Figure 3 is a diagram showing an example of the hardware configuration of a rejection sampling device 10 according to one embodiment. As shown in Figure 3, the rejection sampling device 10 according to one embodiment includes an input device 101, a display device 102, an external I / F 103, a communication I / F 104, a RAM (Random Access Memory) 105, a ROM (Read Only Memory) 106, an auxiliary storage device 107, and a processor 108. Each of these hardware components is connected to communicate via a bus 109.

[0023] The input device 101 is, for example, a keyboard, mouse, touch panel, or physical button. The display device 102 is, for example, a display or display panel. The rejection sampling device 10 does not necessarily have to have at least one of the input device 101 and the display device 102.

[0024] The external I / F 103 is an interface with external devices such as the recording medium 103a. Examples of recording media 103a include CDs (Compact Discs), DVDs (Digital Versatile Disks), SD memory cards (Secure Digital memory cards), and USB (Universal Serial Bus) memory cards.

[0025] The communication interface 104 is an interface for connecting to a communication network. The RAM 105 is a volatile semiconductor memory (storage device) that temporarily holds programs and data. The ROM 106 is a non-volatile semiconductor memory (storage device) that can retain programs and data even when the power is turned off. The auxiliary storage device 107 is a non-volatile storage device such as an HDD (Hard Disk Drive), SSD (Solid State Drive), or flash memory. The processor 108 is a type of arithmetic unit such as a CPU (Central Processing Unit).

[0026] Note that the hardware configuration shown in Figure 3 is just one example, and the hardware configuration of the rejection sampling device 10 is not limited to this. The rejection sampling device 10 may, for example, have multiple auxiliary storage devices 107 or multiple processors 108, or it may not have some of the hardware shown, or it may have various hardware other than the hardware shown.

[0027] <Example of Functional Configuration of Rejection Sampling Device 10> Figure 4 is a diagram showing an example of the functional configuration of a rejection sampling device 10 according to one embodiment. As shown in Figure 4, the rejection sampling device 10 according to one embodiment has an input unit 110, a rejection sampling unit 111, and an output unit 112. Each of these units is realized, for example, by a process in which one or more programs installed in the rejection sampling device 10 are executed by a processor 108 or the like.

[0028] The input unit 110 receives the given input data. The input data includes byte string(r 1 , ..., r τ ) ∈ B τ This includes the length τ of the byte string and the length n' of the random number vector. j is a 1-byte pseudorandom number, τ := τ q,λ (n')

[0029] The rejection sampling unit 111 executes the rejection sampling algorithm described later based on the input data input by the input unit 110, thereby generating a random number vector (v 1 , ..., v n' ) generates.

[0030] The output unit 112 outputs a random number vector (v) generated by the rejection sampling unit 111. 1 , ..., v n' The output data containing ) is output to a predetermined destination (e.g., a storage area such as the auxiliary storage device 107, another program, another device or equipment, etc.).

[0031] <Example of operation of rejection sampling device 10> Figure 5 is a flowchart showing an example of the operation of a rejection sampling device 10 according to one embodiment.

[0032] The input unit 110 receives the given input data (step S101).

[0033] The rejection sampling unit 111 executes the rejection sampling algorithm described later based on the input data input in step S101 above, thereby generating a random number vector (v 1 , ..., v n' ) is generated (step S102).

[0034] The output unit 112 outputs the random number vector (v) generated in step S102 above. 1 , ..., v n' The output data containing ) is output to a predetermined output destination (step S103).

[0035] ≪Rejection Sampling According to Example 1≫ Figure 6 shows an example of rejection sampling according to Example 1. In Figure 6, as an example, the case where q = 7, n' = 7, and τ = 12 is shown. As shown in Figure 6, in rejection sampling according to Example 1, (1) a byte string of τ byte is input, (2) each element is read and a bitwise AND is taken with q to generate non-integer elements less than or equal to q, and (3) if the element is q, the element is rejected and then replenished with an element that has a value (but not q) obtained by taking a bitwise AND of the element read from the supplementary list with q. In this way, in rejection sampling according to Example 1, the bitwise AND is calculated at the timing of reading a 1-byte random number and at the timing of reading an element from the supplementary list. Therefore, it is possible to improve the efficiency of the number of bitwise AND calculations.

[0036] Figure 7 shows an example of the rejection sampling algorithm according to Example 1. As shown in Figure 7, the rejection sampling algorithm according to Example 1 uses byte string(r 1 , ..., r τ ) ∈ B τThe inputs are the length τ of the byte string and the length n' of the random vector, and the random vector (v 1 , ..., v n' ) ∈ F q n' Outputs.

[0037] In the rejection sampling algorithm shown in Figure 7, after setting k←n'+1 (first row), v k While ∧q = q and k < τ + 1, update k ← k + 1 (lines 2-4). This means that k has elements from the supplementary list, v j The index (value of j) of the first element that is not equal to q is stored here.

[0038] Next, v k ←v k After ∧q (line 5), the following is performed for j=1, ..., n' (lines 6-19).

[0039] First, v j ←v j After ∧q (line 7), v j = If q and k < τ + 1, then v j ←v k After that (lines 8-10), v k While ∧q = q and k < τ + 1, update k ← k + 1 (lines 11-12), and then v k ←v k Let ∧q (line 14). On the other hand, v j Even if = q, if k ≥ τ + 1 (i.e., if there are no more elements that can be read from the supplementary list), v j ←Set to 0 (lines 15-16).

[0040] Finally, (v 1 , ..., v n' ) outputs (line 20). This results in q=2 n -1 or less, and v j A random number v such that ≠ q j A random vector (v) whose elements are 1 , ..., v n' ) can be obtained.

[0041] ≪Rejection Sampling According to Example 2≫ In the rejection sampling algorithm according to Example 1, when there are no more elements that can be read from the supplementary list, v j ←0 (line 16 of the rejection sampling algorithm shown in Figure 7). On the other hand, for the random number vector (v 1 , ..., v n' ), if it is possible to set an element where v j =q to 0 by performing a mod calculation in initialization processing or the like of another program or algorithm that takes the vector as input, v j =q may be handled as it is. Therefore, a case where v j =q is handled as it is when there are no more elements that can be read from the supplementary list will be described.

[0042] FIG. 8 is a diagram illustrating an example of the rejection sampling algorithm according to Example 2. As shown in FIG. 8, in the rejection sampling algorithm according to Example 2, a byte string (r 1 , ..., r τ )∈B τ , the length τ of the byte string, and the length n' of the random number vector are input, and the random number vector (v 1 , ..., v n' )∈F q n' is output.

[0043] In the rejection sampling algorithm shown in FIG. 8, after setting k←n'+1 (line 1), the following is executed for j=1, ..., n' (lines 2 to 11).

[0044] v j ←v j ∧q (line 3), then if v j =q, v j ←v k (lines 4 to 5), then while v j =q and k<τ+1, update k←k+1 and v j ←v k ∧q (lines 6 to 9).

[0045] Finally, (v 1 , ..., v n') outputs (line 12). This results in q=2 n A random number v less than or equal to -1 and less than or equal to q. j A random vector (v) whose elements are 1 , ..., v n' ) can be obtained.

[0046] The rejection sampling algorithm according to Example 2 can implement rejection sampling with a simpler configuration than the rejection sampling algorithm according to Example 1. This is because when there are no more elements that can be read from the supplementary list, v j Since it allows us to treat the value as is even if it is equal to q, there is no need to check in the if statement whether k is less than or equal to τ, and we can simply search the supplementary list when substitution is needed (lines 6-8).

[0047] Furthermore, since the supplementary list only needs to be searched when substitution is required, the rejection sampling algorithm according to Example 2 reduces the number of searches by one compared to the rejection sampling algorithm according to Example 1.

[0048] <Summary> As described above, the rejection sampling device 10 according to one embodiment does not read each element constituting the byte string and calculate the bit AND with q, but rather uses an algorithm that reads each element at the necessary timing and calculates the bit AND with q to achieve rejection sampling. This reduces the reading of unnecessary elements and makes it possible to achieve rejection sampling efficiently.

[0049] <Supplement> The functions of the elements disclosed herein may be implemented using circuits or processing circuits that include general-purpose processors, special-purpose processors, integrated circuits, ASICs (Application Specific Integrated Circuits), FPGAs (Field Programmable Gate Arrays), conventional circuits, and / or combinations thereof that are programmed using one or more programs stored in one or more memories, or otherwise configured to perform the disclosed functions. A processor is considered a circuit or processing circuit because it includes transistors and other circuits. A processor may be a programmed processor that executes programs stored in memory. In this disclosure, a circuit, unit, or means is hardware that performs the enumerated functions, or hardware programmed to perform the enumerated functions. Hardware may be any hardware disclosed herein that is programmed or configured to perform the enumerated functions.

[0050] There is a memory for storing a computer program that includes computer instructions. These computer instructions provide logic and routines that enable hardware (e.g., circuits or processing circuits) to perform the methods disclosed herein. This computer program can be implemented in commonly known forms as a computer-readable storage medium, a computer program product, a memory device, a recording medium such as a CD-ROM or DVD, and / or memory of an FPGA or ASIC.

[0051] The following additional information is disclosed regarding the embodiments described above.

[0052] (Note 1) A rejection sampling device for sampling a sequence of pseudorandom numbers of length n' (<τ) from a sequence of pseudorandom numbers of length τ in a uniform distribution between 0 and q, comprising: a memory and at least one processor connected to the memory, wherein the processor generates the j (1 ≤ j ≤ n')th pseudorandom number v j The bitwise logical AND of v between and q j If ∧q is q, then the pseudorandom number v j Rejecting the inequality, we obtain the k-th pseudorandom number v (n'+1 ≤ k ≤ τ). k The bitwise logical AND of v between and q k ∧q (where v k ∧q≠q) is the pseudorandom number v j A rejection sampling device that sets the value to (Note 2) The processor sets the pseudorandom number v for each of j = 1, ..., n'. j The bitwise logical AND of v between and q j Determine whether ∧q is q, and then generate the pseudorandom number v. j The bitwise logical AND of v between and q j If ∧q is q, then the k-th pseudorandom number v (n'+1 ≤ k ≤ τ) k The bitwise logical AND of v between and q k ∧q (where v k ∧q≠q) is the pseudorandom number v j The rejection sampling device described in Appendix 1, which takes the value of as follows. (Appendix 3) The processor uses the k (n'+1 ≤ k ≤ τ)th pseudorandom number v k The bitwise logical AND of v between and q k ∧q (where v k ∧q≠q) is the pseudorandom number v j If it is a value, v k' A rejection sampling device as described in Appendix 2, which updates k with a value of k' (>k) that satisfies ∧q≠q. (Appendix 4) The processor, when k>τ, generates the pseudorandom number v j A rejection sampling device according to appendix 2 or 3, which sets the value of to 0. (Appendix 5) The processor, when k > τ, the pseudorandom number v jA rejection sampling device as described in Appendix 2 or 3, which leaves the value as is. (Appendix 6) The uniform distribution is {0, 1, ..., 2 n-1} (where n is a predetermined integer of 1 or more), q = 2 n-1 The rejection sampling device described in Appendix 1. (Appendix 7) A non-temporary storage medium storing a program that can be executed by a computer to perform a rejection sampling process, which samples a sequence of pseudorandom numbers of length n' (<τ) from a sequence of pseudorandom numbers of length τ in a uniform distribution between 0 and q, wherein the rejection sampling process is performed using the j (1 ≤ j ≤ n')th pseudorandom number v j The bitwise logical AND of v between and q j If ∧q is q, then the pseudorandom number v j Rejecting the inequality, we obtain the k-th pseudorandom number v (n'+1 ≤ k ≤ τ). k The bitwise logical AND of v between and q k ∧q (where v k ∧q≠q) is the pseudorandom number v j A non-temporary storage medium whose value is set to [value].

[0053] The present invention is not limited to the embodiments specifically disclosed above, and various modifications, changes, and combinations with known technologies are possible without departing from the spirit of the claims.

[0054] 10 Rejection sampling device 101 Input device 102 Display device 103 External I / F 103a Recording medium 104 Communication I / F 105 RAM 106 ROM 107 Auxiliary storage device 108 Processor 109 Bus 110 Input section 111 Rejection sampling section 112 Output section

Claims

1. A rejection sampling device that samples a sequence of pseudorandom numbers of length n' (<τ) from a sequence of pseudorandom numbers of length τ in a uniform distribution between 0 and q, wherein the j-th (1 ≤ j ≤ n') pseudorandom number v j The bitwise logical AND of v between and q j If ∧q is q, then the pseudorandom number v j Rejecting the inequality, we obtain the k-th pseudorandom number v (n'+1 ≤ k ≤ τ). k The bitwise logical AND of v between and q k ∧q (where v k ∧q≠q) is the pseudo-random number v j A rejection sampling device having a rejection sampling unit that sets the value to , and .

2. The rejection sampling unit, for each of j=1, ..., n', generates the pseudorandom number v j and the bitwise AND value v of q j ∧q is equal to q or not, and when the bitwise AND value v of the pseudorandom number v j and q j ∧q is equal to q, the bitwise AND value v of the k-th (n'+1≦k≦τ) pseudorandom number v k and q k ∧q (where v k ∧q≠q) is used as the value of the pseudorandom number v j , The rejection sampling apparatus according to claim 1.

3. The rejection sampling unit generates the k-th (n'+1 ≤ k ≤ τ) pseudorandom number v k The bitwise logical AND of v between and q k ∧q (where v k ∧q≠q) is the pseudo-random number v j If it is a value, v k' The rejection sampling device according to claim 2, which updates k with a value of k' (>k) that satisfies ∧q ≠q.

4. The rejection sampling unit, when k > τ, generates the pseudorandom number v j A rejection sampling device according to claim 2 or 3, wherein the value of is set to 0.

5. The rejection sampling unit, when k > τ, generates the pseudorandom number v j The rejection sampling apparatus according to claim 2 or 3, wherein the value is left as is.

6. The uniform distribution is {0, 1, ..., 2 n-1 } (where n is a predetermined integer of 1 or more), q = 2 n-1 The rejection sampling apparatus according to claim 1.

7. A computer that samples a sequence of pseudorandom numbers of length n' (<τ) from a sequence of pseudorandom numbers of length τ in a uniform distribution between 0 and q (inclusive), generates the j-th pseudorandom number v (1 ≤ j ≤ n'). j The bitwise logical AND of v between and q j If ∧q is q, then the pseudorandom number v j Rejecting the inequality, we obtain the k-th pseudorandom number v (n'+1 ≤ k ≤ τ). k The bitwise logical AND of v between and q k ∧q (where v k ∧q≠q) is the pseudo-random number v j A rejection sampling procedure that uses the value of , and a rejection sampling method that performs .