Table 1 describes the truth table of an XOR gate, where *a* And *b* are the inputs and *x* (=*a* ⊕ *b*) is the output. From now on *a* And *b* they are assumed to be uncorrelated random bits (a random bit becomes 0 or 1 stochastically with equal probability).

### Logical point of view

More importantly, XORing two random bits results in another random bit^{34} as follows: *a* And *b* are random bits, so the four possible input combinations [(*A*, *B*) ∈ {(0, 0), (0, 1), (1, 0), (1, 1)}] appear randomly. consequentially, *x* becomes 0 or 1 randomly (i.e., *x* is also a random bit), since *x* includes the same number of 0s as the number of 1s in the truth table. Here we discuss the correlation regarding *a*, *b*And *x* calculating mutual information^{35}, which quantifies the correlation between probability variables. Mutual information between *a* And *x* it is given by

$$Ileft(A;Xright)=Hleft(Aright)+Hleft(Xright)-Hleft(A,Xright)$$

(1)

where is it *h*(*a*) And *h*(*x*) are the logical entropy (i.e. the Shannon entropy of logical states)^{35} or *a* And *x*respectively, and *h*(*a*, *x*) is the joint logical entropy of *a* And *x*. *h*(*a*) it is given by

$$Hleft(Aright)=-sum_{a}Pleft(aright){text{ln}}Pleft(aright)$$

(2)

where is it *a* takes on a value *a* with the probability *P*(*a*). According to table 1, *a* ∈{0, 1} and *P*(0) = *P*(1) = 0.5, which gives*h*( *a*) = ln2. Likewise,*h*(*x*) = − Σ_{x}*P*(*x*) ln*P*( *x*) = ln2, e*h*( *a*,*x*) = − Σ_{a,x}*P*( *a*,*x*) ln*P*( *a*, *x*) = 2ln2. Consequentially,*I*( *a*; *x*) = ln2 + ln2 − 2ln2 = 0, which indicates this *a* And *x* are not related to each other, i.e. the value of cannot be said *a* from a given value of *x*, and viceversa. likewise,*I*( *b*; *x*) = 0 and*I*( *a*; *b*) = 0. Therefore, there is no correlation between any pair of *a*, *b*And *x*. However, *a*, *b*And*x* are related since, if you know the values of any two of the three ( *a*, *b*And *x*), one can tell the value of the other. This is quantified by the mutual information between *a*, *b*And*x* as follows:

$$Ileft(A;B;Xright)=Hleft(Aright)+Hleft(Bright)+Hleft(Xright)-Hleft(A,B right)-Hleft(A,Xright)-Hleft(B,Xright)+Hleft(A, B,Xright)$$

(3)

*h*(*a*) =*h*( *b*) =*h*( *x*) = ln2, e*h*( *a*,*b*) = *h*(*a*, *x*) = *h*( *b*,*x*) = *h*(*a*, *b*,*x*) = 2ln2. consequentially, *I*( *a*; B; *x*) = − ln2. The above discussion indicates that an XOR gate can augment two unrelated random bits ( *a* And *b*) to uncorrelated random three bits (*a*,*b*And*x*), where the correlation appears only when all of*a*,*b*And *x* are considered together.

### thermodynamic point of view

In physical systems, random number generation is related to thermodynamics because logical entropy is related to (thermodynamic) entropy: in the quasi-static limit, Δ*h* = Δ*St* = β*Q*^{35.36}where Δ*h* is the logical change in entropy of the system, Δ *St* is the entropy change of the system, β is the inverse temperature, e*Q*is the heat absorbed by the system. For example, a TRNG AQFP^{27} generates a random bit (that is, Δ*h*= ln2) increasing entropy through heat absorption (i.e., Δ*St*= β*Q*= ln2)^{25}. Therefore, we explore random number generation using XOR gates from a thermodynamic perspective.

We first derive the thermodynamic relations for a logic gate with two uncorrelated random inputs (*a*And*b*) and an output (*x*). From EQ. (3), the total change in logic entropy during a logic operation is given by

$$Delta Hleft(A, B,Xright)=Delta Hleft(A,Bright)+Delta Hleft(A,Xright)+Delta Hleft(B ,Xright)-Delta Hleft(Aright)-Delta Hleft(Bright)-Delta Hleft(Xright)+Delta Ileft(A;B;X right)$$

(4)

The inputs do not change during a logical operation, so Δ *h*(*a*) = Δ*h*(*b*) = Δ*h*( *a*,*b*) = 0. Also, the total logical change in entropy is related to heat absorption. Thus, in the quasi-static limit (that is, assuming that the logical operation is performed without energy dissipation), Eq. (4) becomes

$$Delta Hleft(A, B,Xright)=Delta {H}_{text{eff}}left(Xright)+Delta Ileft(A;B;X right)=beta Q$$

(5)

where Δ*h*_{eff}( *x*) = Δ*h*(*a*, *x*) + Δ*h*(*b*, *x* ) – Δ *h* ( *x*) is the logical effective entropy change of *x* ; d *h*_{eff}( *x* ) becomes ln2 when *x*is a random bit that is uncorrelated with*a*or*b*. Conventional logic gates operate deterministically and do not include entropy-increasing processes such as heat absorption; Like this, *Q*= 0 and Eq. (5) boils down to

$$Delta {H}_{text{eff}}left(Xright)=-Delta Ileft(A;B;Xright)$$

(6)

This equation shows that even if a logic gate does not include entropy-increasing processes, the logic gate can generate a random bit by producing information about each other.

Figure 1 shows the change in logical entropy and mutual information related to an XOR gate. *a* And*b*are random bits, so that *h*(*a*) = *h*(*b*) = ln2. In the initial state (Fig. 1a), *x*is not generated yet and therefore *h*(*x*) = 0, which results in *h*( *a*, *x*) = *h*( *b* , *x* ) = ln2 e*I*( *a*; *b*; *x*) = 0. In the final state (Fig. 1b), *x*is calculated by *a* And *b*: *h*(*x* ) = ln2. As mentioned above, any pair of *a*,*b*And *x*are not related to each other, but *a*,*b*And *x*they are related; Like this, *h*(*a*,*x*) =*h*(*b*, *x*) = 2ln2 e *I*( *a*; *b*; *x* ) = − ln2. Therefore, Δ*h*_{eff}( *x* ) = -Δ *I*(*a*;*b*;*x*) = ln2, which indicates that the XOR gate generates a random bit yielding information about each other, and that XOR-based random number generation agrees with thermodynamics.