## 3 Materials and Methods
\begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Approximately** & **Level 1** & **Level 2** & **Level 3** & **Level 4** \\ \hline Frequency & 0.8165 (49/50) & 0.9558 (50/50) & 0.0200 (49/50) & 0.8514 (49/50) \\ \hline Block Frequency & 0.4190 (49/50) & 0.4190 (47/50) & 0.8832 (49/50) & 0.1917 (49/50) \\ \hline Cumulative Sums & 0.5207 (2/2) & 0.4356 (2/2) & 0.6101 (2/2) & 0.1563 (2/2) \\  & (49/50) & (50/50) & (49/50) & (49/50) \\ \hline Runs & 0.6993 (48/50) & 0.6993 (50/50) & 0.4944 (50/50) & 0.4599 (50/50) \\ \hline Longest Run & 0.2897 (50/50) & 0.6993 (50/50) & 0.9915 (50/50) & 0.8832 (50/50) \\ \hline Rank & 0.08599 (50/50) & 0.5341 50/50) & 0.3505 (49/50) & 0.0352 (50/50) \\ \hline FFT & 0.1223 (50/50) & 0.0757 (49/50) & 0.5749 (49/50) & 0.2897 (50/50) \\ \hline Non-Overlapping & 0.4968 (148/148) & 0.4881 (148/148) & 0.5800 (148/148) & 0.5900 (148/148) \\ Template & (\(\sim\) 0.49/50) & (\(\sim\) 49/50) & (\(\sim\) 49/50) & (\(\sim\) 49/50) \\ \hline Overlapping Template & 0.3838 (50/50) & 0.1719 (48/50) & 0.9558 (48/50) & 0.4190 (49/50) \\ \hline Universal & 0.3505 (50/50) & 0.0156 (50/50) & 0.3838 (48/50) & 0.9915 (49/50) \\ \hline Approximate Entropy & 0.0669 (48/50) & 0.9558 (49/50) & 0.6993 (50/50) & 0.1088 (50/50) \\ \hline Random Excursions & 0.2865 (8/8) & 0.1094 (8/8) & 0.3629 (8/8) & 0.4111 (8/8) \\  & (\(>\)36/38) & (\(>\)37/38) & (\(>\)33/34) & (\(>\)32/33) \\ \hline Random Excursions Variant & 0.2867 (18/18) & 0.3328 (18/18) & 0.4612 (18/18) & 0.3969 (18/18) \\  & (\(>\)36/37) & (\(>\)37/38) & (\(>\)33/34) & (\(>\)32/33) \\ \hline Serial & 0.6511 (2/2) & 0.9537 (2/2) & 0.1753 (2/2) & 0.5116 (2/2) \\  & (\(>\)49/50) & (\(50/50\)) & (49/50) & (49/50) \\ \hline Linear Complexity & 0.0352 (50/50) & 0.2622 (50/50) & 0.5749 (49/50) & 0.9717 (50/50) \\ \hline \hline \end{tabular}
\end{table} 
Table 3: NIST results. ### Bias Analysis

The bias of the outputted stream has been analyzed for each approach. To this end, the following experiment has been carried out. For each subject (199 in total), a file of 0.5 MB has been generated using the same procedure as described in Section 3 and analyzed using the ENT suite. In Figure 4, a box-plot of the chi-square values is shown. It is worth noting that the optimal value of the chi-square test was 256, and the greater the distance to this optimal value, the greater the bias in the data. Using this analysis, it could be concluded that the fourth level approach was the most appropriate to build a secure and robust TRNG based on ECG signals: the average value (blue circle) was the optimal one, and the distribution of values between the first and third quartile was the narrowest. ### Distinctiveness Analysis

We have tested whether the random data generated from different ECG signals (each one belonging to a single individual) were distinct. If this holds, an adversary cannot use data from another individual to predict values generated by the target. To evaluate this, as in Section 4.1, a file of

Figure 4: Bias analysis. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Approximately** & **Level 1** & **Level 2** & **Level 3** & **Level 4** \\ \hline Entropy & 7.999998 & 7.999998 & 7.999998 & 7.999998 \\ \hline Optimum Compression & 0 \% & 0 \% & 0 \% & 0 \% \\ \hline Chi Square & 279.22 (14.24 \%) & 268.41 (26.99 \%) & 235.82 (80.01 \%) & 2313.44 (0.73 \%) \\ \hline Arithmetic Mean Value & 127.4657 & 127.4731 & 127.4896 & 127.4931 \\ \hline Monte Carlo \(\pi\) Value & 3.141955902 & 3.142772504 & 3.141912708 & 3.141860883 \\ \hline Serial Correlation Coefficient & \(-\)0.000105 & 0.000022 & \(-\)0.000124 & 0.000058 \\ \hline \hline \end{tabular}
\end{table} 
Table 5: ENT results. 0.5 MB has been generated for each individual (ECG record). Then, for each file, data were grouped into \(\{8,16,32,64\}\)-bit words. In Figure 5, the data distribution of the Hamming distance between all the pairs (\(C_{199,2}\) in our particular case) of individuals belonging to the dataset is shown.