## 3 Materials and Methods
The signal is then sub-sampled by 2, and the process is repeated to increase the level of decomposition. In particular, the number of iterations is conditioned by the pursued decomposition level. The procedure is summarized in Figure 3; the reader can consult [37] for a detailed explanation. As for the wavelet decomposition, there are two key-parameters that need to be set and a wide range of possibilities are studied in the following sections. On the one hand, \(L\) parameter sets the decomposition level: \(L=\{1,2,3,4\}\) are the tested levels. On the other hand, \(wf\) sets the wavelet family (e.g., Daubechies or coiflets) used in the decomposition and determines the filters used (\(g[n]\) and \(h[n]\)). Figure 3: Wavelet decomposition of a signal \(x[n]\). Figure 2: Hardware for building an ECG-based RNG. Finally, random bits are extracted (entropy extraction procedure in Algorithm 1) using a kind of quantization. More precisely, the fractional part of each coefficient is converted into a 32-bit unsigned value, and then, the 8 LSB bits are extracted. Mathematically, let \(c_{i}\) be a coefficient of wavelet-decomposition and \(r_{i}\) an outputted random byte. Then,

\[ \begin{array}{rcl}z_{i}&=&uint32((c_{i}\times 10^{4})\gg 24)\\ r_{i}&=&z_{i}(0,\ldots,7)\end{array} \ \ \Ill \tag{1}\]

Although the proposal was initially evaluated with ECG records obtained with the BITalino board, an in-depth analysis has been carried out, using a well-known and public dataset that uses three electrodes. More precisely, the E-HOL-03-0202-003 dataset, which was provided by the Telemetric and ECG Warehouse (THEW) of University of Rochester (dataset available at: [[http://thew-project.org/index.htm](http://thew-project.org/index.htm)]([http://thew-project.org/index.htm](http://thew-project.org/index.htm))), has been employed. ECG records were acquired using three pseudo-orthogonal lead configuration (X, Y and Z), and the sampling frequency was set to 200 Hz. The descriptive statistics of the dataset are summarized in Table 2.

This database has features that are not present in many other public datasets. First, the number of individuals (ECG signals) is very large (i.e., 202 subjects; in our experiments, 3 ECG records were discarded due to the very short length of these recordings). Secondly, each ECG record lasts around 24 h, which is much longer than the length of ECG files available in many other public datasets. Finally, it is worth mentioning that the subjects were healthy, and therefore uniformity in the distribution can be assumed. ## 4 Results and Analysis

To assess the randomness quality of the outputted bits, three of the most common statistical tests batteries to evaluate the randomness quality of a RNG have been used: NIST [38], DIEHARDER [39] and ENT [32]. NIST is the most demanding battery and requires long files (several tens of megabytes). In our particular case, files with a size of around 100 MB have been generated. For each subject (199 in total), experiments lasted between 4 and 6 h (the time interval was randomly chosen from the 24 h available of the ECG signal), and therefore, 0.5-MB files were obtained per subject after the entropy extraction by wavelet analysis (see Section 3 for details). Finally, all the files were appended (assuming independent and identically distributed random variables), and this was the file analyzed; note that the NIST suite requires files of at least 30 MB that would require the recording of one individual during approximately 15 days. In relation to the parameters \(wf\) and \(L\), Daubechies was the family used (the number of vanishing moments was set to \(N=4\)), and there were 1-4 levels tested. Tables 3-5 summarize the results obtained with the NIST, DIEHARD and ENT suites for the four configurations studied. It is noteworthy that the NIST suite is devoted to test RNGs that have been designed for security purposes. Table 3 shows the \(p\)-value and the proportion of tests that pass each one of the fifteen tests included in the suite.