<figure><img src="image_1.png" /></figure>

HAL
open science

# The influence of the random numbers quality on the results in stochastic simulations and machine learning

Benjamin A. Antunes

<figure><img src="image_2.png" /></figure>

## To cite this version:

Benjamin A. Antunes. The influence of the random numbers quality on the results in stochastic simulations and machine learning. 2025. hal-05330437

HAL Id: hal-05330437

https://hal.science/hal-05330437v1

Preprint submitted on 28 Oct 2025

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_3.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# The influence of the random numbers quality on the results in stochastic simulations and machine learning

Antunes Benjaminª

ªUniversity of Perpignan via domitia, Perpignan, 66100, France

## Abstract

Pseudorandom number generators (PRNGs) are ubiquitous in stochastic simulations and machine learning (ML), where they drive sampling, parameter initialization, regularization, and data shuffling. While widely used, the potential impact of PRNG statistical quality on computational results remains underexplored. In this study, we investigate whether differences in PRNG quality, as measured by standard statistical test suites, can influence outcomes in representative stochastic applications. Seven PRNGs were evaluated, ranging from low-quality linear congruential generators (LCGs) with known statistical deficiencies to high-quality generators such as Mersenne Twister, PCG, and Philox. We applied these PRNGs to four distinct tasks: an epidemiological agent-based model (ABM), two independent from-scratch MNIST classification implementations (Python/NumPy and C++), and a reinforcement learning (RL) CartPole environment. Each experiment was repeated 30 times per generator using fixed seeds to ensure reproducibility, and outputs were compared using appropriate statistical analyses. Results show that very poor statistical quality, as in the “bad” LCG failing 125 TestU01 Crush tests, produces significant deviations in ABM epidemic dynamics, reduces MNIST classification accuracy, and severely degrades RL performance. In contrast, mid- and good-quality LCGs—despite failing a limited number of Crush or BigCrush tests—performed comparably to top-tier PRNGs in most tasks, with the RL experiment being the primary exception where performance scaled with statistical quality. Our findings indicate that, once a generator meets a sufficient statistical robustness threshold, its family or design has negligible impact on outcomes for most workloads, allowing selection to be guided by performance and implementation considerations. However, the use of low-quality PRNGs in sensitive stochastic computations can introduce substantial and systematic errors.
# 1. Introduction

Randomness is a cornerstone of modern computational science, forming the basis for algorithms in both stochastic simulations and ML. In practice, the majority of applications use PRNGs rather than true random number sources. PRNGs are deterministic algorithms that generate sequences of numbers designed to mimic the statistical properties of truly random sequences, enabling reproducibility, efficiency, and scalability. The quality of the generated numbers—determined by statistical properties such as uniformity, independence, and period length—can have a direct impact on the stability, accuracy, and reproducibility of results.

The usage of PRNGs in ML is widespread. Many core algorithms rely on randomness as an integral part of their functioning. A notable example is stochastic gradient descent (SGD), a cornerstone optimization algorithm for training models in ML and deep learning. SGD operates by using a single or small batch of training samples to compute the gradient and update parameters, rather than processing the entire dataset at once. Lu et al. [1] demonstrated that using a quasi-Monte Carlo method can accelerate convergence rates for learning with data augmentation, also employing a fixed scan order to improve efficiency.

Randomness also underpins key regularization methods. Dropout, for example, combats overfitting by randomly omitting neurons and their connections during training, improving generalization on unseen data. Stochastic depth, another regularization technique, addresses challenges in deep convolutional networks such as vanishing gradients and long training times by randomly removing layers during each batch and connecting the remaining layers via the identity function, reducing training time and sometimes improving accuracy [2].

Data augmentation methods incorporate randomness to enlarge datasets and improve model robustness. In image tasks, augmentation can involve transformations such as rotation, cropping, flipping, color adjustments, kernel filtering, image mixing, random erasing, or neural style transfer. Some approaches extend augmentation to evaluation through test-time augmentation, introducing variability at inference to improve resilience [3]. These methods are used in algorithms such as Expectation-Maximization, posterior
sampling, and Markov chain Monte Carlo methods [4]. Bootstrapping is an-
other randomness-based technique, generating multiple resampled datasets
through sampling with replacement, useful in ensemble learning to enhance
stability and accuracy [5].

Randomness is also a key factor in many advanced ML paradigms: Bayesian neural networks [6], variational autoencoders [7], reinforcement learning [8], and even gradient noise injection [9]. Recent research has also examined PRNG usage in ML in relation to hardware performance and energy consumption [10]. Kim et al. [11], for example, applied stochastic computing (SC) to deep neural networks, improving latency and power efficiency; SC, originally introduced by John von Neumann in the 1960s, encodes and processes information through random bitstreams. Liu et al. [12], however, noted that SC can be energy-inefficient for some deep learning applications.

Transformer architectures—now central in domains from computer vision to natural language processing—also depend on randomness during training, including in SGD and dropout phases. Large language models such as GPT still rely on strong random generators for parameter initialization and regularization. The quality of these generators can influence the final system, as shown by Pranav et al. [13], who explored how attackers might exploit weaknesses in PRNGs to compromise ML systems. PRNGs also play a role in computational learning theory, including in criteria for Probably Approximately Correct (PAC) learning [14].

Real-world applications further highlight PRNG importance: in microfluo-
idic device studies of drop coalescence, random forest models have been ap-
plied [15, 16], relying on randomness for tree construction. Gundersen et
al. [17] list the lack of control over PRNG behavior as one source of irrepro-
ducibility in ML.

In high-performance computing (HPC) and scientific simulations, PRNGs remain the standard, primarily because reproducibility is essential for debugging and verification. True random numbers are often too slow to generate and too large to store for large-scale simulations, making them impractical for workloads that require retracing execution. Applications such as high-energy physics or nuclear medicine simulations may require up to 10¹² random numbers for a single replicate, with thousands of replicates to achieve statistical precision. Even with the fastest available storage, saving such quantities of true random data is infeasible.

Quasi-random numbers can be used in specific contexts such as numerical integration in finance, but without certain improvements they suffer from
limitations in high dimensions [18]. Quantum computing, with its intrinsic
physical randomness, holds promise for future large-scale stochastic simu-
lations [19, 20], but until such systems are widely available, high-quality
PRNGs remain the most efficient and reliable choice. These generators pro-
duce streams deterministically, with the generator's source code serving as
the ultimate proof of correlation structure. When properly designed, statis-
tical tests fail to detect any structure—hence their common description as
"random numbers." However, it remains possible that future statistical tests
will reveal weaknesses in today's best PRNGs.

The default PRNG in Python and PyTorch is the Mersenne Twister (MT) [21], while TensorFlow defaults to Philox (with Threefry from the same cryptographically inspired family also available) [22]. NumPy offers several PRNG choices; its default is PCG [23], but MT and Philox are also supported.

Philox, Threefry, and ARS were introduced by Salmon et al. at the 2011 Supercomputing Conference. They use cryptographic techniques similar to AES, offering strong statistical properties though at a cost in speed. PCG, created in 2014 by O'Neill, claims superior statistical quality. MT, developed in 1998 by Matsumoto and Nishimura and updated in 2002, is known for its long period but also for failing certain statistical tests. Despite its weaknesses, MT remains one of the most used PRNGs in stochastic simulations.

Linear congruential generators (LCGs) are among the earliest PRNG de-
signs, simple and fast but prone to statistical deficiencies. Their quality
depends heavily on parameters. For example, in our BigCrush tests from the
TestU01 suite, a poorly chosen LCG with modulus 2³¹, multiplier 65539, and
increment 0 achieved a period of 2²⁹ and failed 125 of the 144 Crush tests,
indicating severe deficiencies. A moderately better LCG with modulus 2⁴⁸,
multiplier 25214903917, and increment 11 had a period of 2⁴⁸ but still failed
21 Crush tests. Even a well-parameterized LCG with modulus 2⁶³, multi-
plier 9219741426499971445, and increment 1—often considered “good” for
practical purposes—failed 5 Crush and 7 BigCrush tests. These results high-
light the wide performance gap among LCGs and the importance of PRNG
selection for statistical robustness.

PRNG quality is assessed using statistical test suites. Knuth proposed early tests in “The Art of Computer Programming” [24]. Marsaglia’s Diehard tests expanded on this with 15 statistical tests, later extended by Brown et al. in the Dieharder suite. The NIST Statistical Test Suite (STS) [25] is widely used in cryptographic contexts. The most comprehensive is TestU01 [26],
offering multiple levels of testing: SmallCrush, Crush, and BigCrush.

In this work, we use the TestU01 BigCrush battery as the reference. PCG and Philox are considered resistant to BigCrush failures, while MT is known to fail two tests. To compare with lower-quality generators, we include the aforementioned LCGs with varying parameter quality, as well as the standard C random generator, which uses a linear feedback shift register whose complexity depends on the available state size.

The aim of this paper is to evaluate the extent to which the statistical quality of the random numbers influences results in stochastic simulations and ML applications. By testing PRNGs ranging from high-quality modern generators to deliberately weaker designs, and by applying them to representative workloads from both domains, we seek to quantify the performance, accuracy, and reproducibility impacts of PRNG choice.

## 2. Related Work

The influence of the quality and source of randomness on computational tasks has been investigated in both machine learning (ML) and stochastic simulations, though the body of literature remains comparatively sparse.

In the context of neural networks, Huk [27] explored the relationship between PRNG quality and classification performance in convolutional neural networks (CNNs) and multilayer perceptrons (MLPs). By drawing 95% confidence intervals for quality measurements across different PRNGs, they demonstrated that variations in PRNG choice can lead to measurable changes in model performance, as evidenced by non-overlapping confidence intervals. These results suggest that the PRNG algorithm may influence training quality sufficiently to warrant adjustments in the interpretation of evaluation metrics. Koivu et al. [28] further established a correlation between PRNG statistical quality and the performance of dropout regularization in neural networks. Their findings reinforce the idea that generator quality can propagate through stochastic methods, influencing model generalization.

Several studies have examined PRNG effects in simulation-based domains. For example, in [29] the authors compared three generators—the standard linear congruential generator (LCG), a modified LCG used in BOSS software, and the Mersenne Twister (MT)—for Monte Carlo simulations of liquid butane, methanol, and hydrated alanine polypeptides. While MT and the modified LCG produced similar results, the standard LCG yielded significant deviations, including up to 24% higher average molecular volumes for
methanol and up to 87% larger volumes for hydrated tridecaalanine. These
results highlight the potential for poor-quality PRNGs to introduce system-
atic biases in physical simulations.

Beyond PRNG algorithm choice, several works have addressed the in-
fluence of random seeds on ML training outcomes. The study [30] scanned
up to 10⁴ seeds for popular computer vision architectures on CIFAR-10 and
tested fewer seeds on ImageNet, revealing that while variance is generally
small, extreme outlier seeds can produce significantly better or worse re-
sults than the mean. Similarly, [31] quantified instability introduced by seed
variation, finding that randomness can affect interpretability methods (e.g.,
attention maps, gradient-based explanations, LIME) and proposing Aggres-
sive Stochastic Weight Averaging (ASWA) to reduce performance variance
by 72%.

The comparison between pseudo and true (or quantum) randomness has also attracted attention. Lebedev et al. [32] showed that quantum random number generators (QRNGs) can yield statistically significant accuracy improvements over PRNGs for certain simulations, including approximating $\pi$ and Buffon's needle, with potential error reductions up to 1.89×. Similarly, [33] studied QRNG versus PRNG usage in initial weight distributions of dense and convolutional neural networks, as well as in decision tree splits. While QRNG occasionally outperformed PRNG in classification accuracy (e.g., +2.82% for EEG classification in dense networks), differences were often small and dataset-dependent.

A broader ML-focused study, [34], assessed PRNG period length and determinism across multiple algorithms, finding that period length could significantly affect logistic regression, random forests, and LSTMs, while having minimal impact on linear regression. Likewise, [28] investigated five PRNGs for dropout in neural networks across four classification tasks, showing that true randomness could improve or degrade performance depending on the dataset and prediction problem.

Finally, in the domain of large language models, [35] assessed that seed choice can affect both macro-level metrics (accuracy, F1) and micro-level prediction consistency on GLUE and SuperGLUE benchmarks. Variance was significant enough to warrant explicit consideration of seed selection in LLM fine-tuning and evaluation pipelines.

Overall, these works collectively show that PRNG quality, seed choice,
and entropy source can all influence the performance, stability, and repro-
ducibility of ML models and stochastic simulations. However, most studies
have been limited to compare PRNGs to QRNGs, while we have seen earlier
that QRNGs cannot be used in practice for large scale simulation. Stud-
ies also focus on specific architectures or simulation types, and few have
systematically compared PRNGs of varying statistical quality across both
domains. This gap motivates our work, which aims to quantify the extent
to which PRNG quality affects results in representative ML and simulation
workloads.

3. Materials and methods

The primary objective of this study was to evaluate whether the statistical quality of PRNGs has a measurable impact on the outcomes of stochastic applications. We focused primarily on PRNGs that are widely used in both ML and stochastic simulation, chosen for their strong statistical properties, but also included deliberately weaker generators to serve as baselines for comparison.

To cover a range of computational domains and stochastic behaviors, we
selected four representative applications. The first was a large-scale epidemio-
logical agent-based model (ABM), from prior work by [36]. This ABM reflects
the complexity of HPC simulations, with numerous interacting agents and a
high degree of stochasticity. The second and third applications were two
independent implementations of the MNIST handwritten digit classification
task, developed entirely from scratch: one using Python with NumPy<fnref n="1" />, and
another in C++<fnref n="2" />. The fourth application was a RL environment implement-
ing the CartPole task, also developed from scratch in Python<fnref n="3" />. While the
ABM is representative of large, high-dimensional simulations, the ML and
RL cases serve as controlled, repeatable experiments where specific sources
of randomness—such as weight initialization, batch selection, dropout, and
environmental transitions—can be directly examined.

For each application, the source code was modified to allow explicit se-
lection of the PRNG. Seven different generators were tested. These included
three linear congruential generators (LCGs) of progressively higher statistical
quality:

<footnote n="1">¹https://github.com/yawen-d/Neural-Network-on-MNIST-with-NumPy-from-Scratch/tree/master</footnote>

<footnote n="2">²https://github.com/JanPokorny/mnist-from-scratch/tree/master</footnote>

<footnote n="3">³https://github.com/Ancientkingg/cartpole</footnote>
* a “bad” LCG with parameters $m = 2^{31}$, $a = 65539$, $c = 0$, known to fail the majority of TestU01 Crush tests (125 tests failed);

* a “mid” LCG with parameters $m = 2^{48}$, $a = 25214903917$, $c = 11$, failing 21 Crush tests;

* a “good” LCG with parameters $m = 2^{63}$, $a = 9219741426499971445$, $c = 1$, which fails only a small number of BigCrush tests (7 tests failed).

In addition to these, we included the widely used MT, the PCG, the counter-based Philox generator, and the default C library `rand()` function, implemented as a linear-feedback shift register (LFSR)-based method. PCG and Philox are generally considered BigCrush-resistant, whereas MT is known to fail two BigCrush tests but remains a de facto standard in many scientific computing contexts.

All experiments were conducted under a repeated-measures design. Each application was executed 30 times for every PRNG, using fixed but distinct seeds to ensure reproducibility and to enable statistical analysis. This setup allowed computation of means and 95% confidence intervals, as well as the application of parametric and non-parametric significance tests to detect differences between PRNGs. The full codebase, including PRNG-selection modifications, is available in the project's public repository: githubdouble-blind.

Performance evaluation was tailored to each application. In the MNIST experiments, classification performance was quantified using accuracy, defined as the proportion of correctly classified samples in the validation set. The validation dataset was distinct from the training set to ensure that the reported accuracy reflected the model's generalization capability. Accuracy was expressed as a percentage and aggregated across the 30 runs for each PRNG to compute descriptive and inferential statistics.

In the CartPole RL experiments, performance was measured by the average reward per episode, calculated as the sum of rewards obtained over all episodes divided by the number of episodes. Each time step in which the pole remained balanced yielded a reward of +1. Episodes terminated when the pole's angle exceeded a specified threshold or the cart moved beyond the track boundaries. In this implementation, the maximum achievable reward per episode was 500. Average reward thus reflected the agent's sustained stability and control throughout an episode.

For the epidemiological ABM, analysis focused on two critical epidemic indicators: the timing and amplitude of the infection peak. The maxi-
mum number of infections in the first epidemic peak was compared between PRNGs using one-way analysis of variance (ANOVA) under the assumptions of normality and homoscedasticity [37]. When normality was not met, the non-parametric Kruskal-Wallis test [38] was applied to the time step corresponding to the first infection peak to assess differences in timing. Beyond peak comparisons, entire epidemic time series were analyzed to assess similarity in temporal evolution.

The choice of these specific applications allowed us to evaluate PRNG effects across scenarios differing in complexity, dimensionality, and stochastic dependency.

# 4. Results

The epidemiological agent-based model exhibited a clear and statistically significant influence of the pseudorandom number generator on both the height and timing of infection peaks. Analysis of variance for peak height yielded $F = 13.8692$ with $p = 5.5162 \times 10^{-15}$, corresponding to a large effect size of $\eta^2 = 0.2950$. Post-hoc Tukey HSD comparisons showed that the poor-quality LCG consistently produced peak values that were significantly different from all other PRNGs, whereas the remaining generators—mid- and good-quality LCGs, Mersenne Twister, PCG, Philox, and the C `rand()` implementation—were statistically indistinguishable from one another.

Similar results were observed for the timing of epidemic peaks. Here, the ANOVA returned $F = 63.1213$ with $p = 3.0604 \times 10^{-50}$ and an even larger effect size ($\eta^2 = 0.6557$), again indicating that only the bad LCG produced timing patterns significantly different from the other generators.

The mean epidemic curves for each PRNG are presented in Figure 1. With the exception of the poor-quality LCG, all curves overlap almost perfectly, indicating very similar epidemic dynamics. The trajectory obtained with the bad LCG is clearly displaced, with altered amplitude and peak timing, reflecting the statistical findings.

Figure 2 shows all individual epidemic curves for all PRNGs across the 30 replicates. For all high-quality generators, the curves remain tightly grouped despite stochastic variability, whereas the bad LCG yields several realizations with markedly different temporal patterns. These deviations, if occurring in real-world decision-support simulations, would represent substantial biases in both timing and severity projections.
<figure><img src="image_4.png" /><figcaption>Figure 1: Mean epidemic curves for each PRNG. The poor-quality LCG shows a visible displacement in amplitude and timing.</figcaption></figure>

<figure><img src="image_5.png" /><figcaption>Figure 2: Individual epidemic curves for each PRNG across 30 replicates.</figcaption></figure>
In the NumPy-based MNIST classification experiment, the choice of PRNG had a strong impact on accuracy. The ANOVA indicated *F* = 181.3880, *p* = 1.0430 × 10<sup>-78</sup>, with a very large effect size (*η*<sup>2</sup> = 0.8428). All high-quality PRNGs achieved accuracies around 97.4–97.5%, whereas the bad LCG averaged 94.42%, a difference confirmed by the Tukey HSD analysis to be significant at *p* < 0.001. No significant differences were found among the high-quality generators.

<figure><img src="image_6.png" /><figcaption>Figure 3: Violin plots for MNIST (NumPy) classification accuracy by PRNG.</figcaption></figure>

Figures 3 and 4 illustrate these results. The high-quality generators exhibit tight and nearly identical distributions, while the bad LCG’s distribution is both shifted downward and more dispersed. Non-parametric Kruskal–Wallis testing confirmed the same pattern ($p$ = 7.3455 × 10<sup>-16</sup>), reinforcing the robustness of the finding.

In contrast, the C++ MNIST implementation produced no statistically
significant differences between PRNGs. The mean accuracies ranged from
79.47% to 86.68%, with broad overlap of confidence intervals and an ANOVA
<figure><img src="image_7.png" /><figcaption>Figure 4: Box plots for MNIST (NumPy) classification accuracy by PRNG.</figcaption></figure>
result of *F* = 1.6162, *p* = 0.144, effect size *η*² = 0.0456. Standard deviations were notably higher for the bad LCG, Philox, and RandC, suggesting occasional unstable runs, but these differences did not reach statistical significance.

<figure><img src="image_8.png" /><figcaption>Figure 5: Violin plots for MNIST (C++) classification accuracy by PRNG.</figcaption></figure>

Figures 5 and 6 show the distributions for all generators, revealing gen-
erally similar central tendencies but greater variability for certain PRNGs.
Non-parametric tests corroborated the absence of significant differences.

The reinforcement learning CartPole experiment revealed the highest sensitivity to PRNG quality. The ANOVA indicated *F* = 149.7456, *p* = 1.5386 × 10⁻⁷¹ with a large effect size (*η*² = 0.8164). The bad LCG produced an average reward of only 9.37, indicating almost immediate failure in balancing the pole. Mid- and good-quality LCGs achieved moderate performance around 72, while the top-performing generators—Mersenne Twister, PCG, Philox, and RandC—consistently produced average rewards between 285 and 328. Tukey HSD testing confirmed that all LCG variants differed
<figure><img src="image_9.png" /><figcaption>Figure 6: Box plots for MNIST (C++) classification accuracy by PRNG.</figcaption></figure>
significantly from the high-quality PRNGs, while the differences among the
latter group were not statistically significant.

<figure><img src="image_10.png" /><figcaption>Figure 7: Violin plots for average CartPole rewards by PRNG.</figcaption></figure>

Figures 7 and 8 present these results, showing a clear separation between
poor-quality generators, intermediate-quality LCGs, and top-tier PRNGs.

**5. Discussion**

The results obtained across the four experimental settings reveal that
the statistical quality of the pseudorandom number generator can influence
stochastic computations to markedly different degrees depending on the ap-
plication.

In the epidemiological ABM and the NumPy-based MNIST experiment,
poor statistical quality in the PRNG resulted in significant and consistent
deviations from the results obtained with higher-quality generators. In the
<figure><img src="image_11.png" /><figcaption>Figure 8: Box plots for average CartPole rewards by PRNG.</figcaption></figure>
ABM, these deviations manifested as shifts in both the timing and amplitude of epidemic peaks, patterns that, in a real-world policy context, could lead to incorrect conclusions regarding intervention timing and resource allocation. In the NumPy MNIST case, the lower accuracy and greater variability associated with the bad LCG suggest that poor-quality randomness can hinder convergence to optimal solutions in stochastic gradient descent training.

In contrast, the C++ MNIST implementation showed no statistically significant dependence on PRNG choice, even though larger variability was observed for some generators. This may reflect differences in the implementation, numerical precision, or the reduced sensitivity of the specific training procedure to random variations in initialization and data shuffling.

The reinforcement learning CartPole experiment, however, demonstrated to be sensitive to PRNG quality. In this setting, mid- and good-quality LCGs produced intermediate results, while high-quality PRNGs achieved markedly better control and stability, and the bad LCG failed catastrophically.

These findings suggest that the primary determinant of impact is not the algorithmic family of the generator—whether congruential, Mersenne Twister, or counter-based—but rather its measured statistical quality in standardized test suites such as TestU01 BigCrush. In our experiments, once a PRNG passed a threshold of statistical robustness, its results were generally indistinguishable from other top-tier generators, even if the underlying algorithmic principles differed. Philox, PCG, and Mersenne Twister, despite their distinct architectures, produced equivalent results in all tasks.

Nevertheless, the consequences of using a low-quality PRNG in scientific computing remain serious. The bad LCG used in this study, which fails 125 Crush tests in TestU01, consistently produced aberrant results in both simulations and machine learning, sometimes introducing systematic biases. This confirms that while performance considerations may drive PRNG selection for many applications—such as preferring Philox for parallel simulations or PCG for sequential workloads—the statistical quality of the generator must first meet a minimum standard.

Overall, these results demonstrate that in most stochastic simulations and machine learning tasks, high-quality PRNGs of different families can be used interchangeably without affecting outcomes, and the choice may therefore be guided by performance, ease of implementation, or parallelization requirements.
# 6. Conclusion

This study evaluated the influence of PRNG statistical quality on the outcomes of both stochastic simulations and machine learning tasks, encompassing a large-scale epidemiological ABM, two from-scratch MNIST training implementations, and a reinforcement learning CartPole environment. By systematically varying the generator across seven PRNGs of differing statistical quality and repeating each experiment 30 times with fixed seeds, we were able to isolate the effect of generator choice from other sources of variability.

The results demonstrate that extremely poor statistical quality, exemplified by a low-parameter LCG failing most of the TestU01 Crush tests, can substantially distort simulation outputs and degrade ML performance. Such effects were evident in all experimental domains, ranging from shifts in epidemic peak timing and amplitude in the ABM to reduced classification accuracy in MNIST and almost complete failure in CartPole.

Once the statistical quality exceeded a certain threshold, however, the performance differences between generators became negligible in most settings. Mid- and good-quality LCGs, despite some statistical weaknesses, performed comparably to high-quality generators such as PCG, Philox, and Mersenne Twister in the ABM and MNIST experiments, though CartPole remained sensitive to generator quality.

These findings suggest that for most stochastic simulations and ML tasks, PRNG selection can be based on computational performance, implementation convenience, and hardware suitability, provided that the chosen generator meets a robust statistical quality standard. Above all, the use of low-quality PRNGs in scientific computing should be avoided, as their deficiencies can propagate into significant and systematic errors in model outputs.

# Acknowledgements

The author thanks the maintainers of the open-source software and libraries used in this study. This research did not receive any specific grant from funding agencies in the public, commercial, or not-for-profit sectors.
## References

[1] Y. Lu, S. Y. Meng, C. De Sa, A general analysis of example-selection for stochastic gradient descent, in: International Conference on Learning Representations (ICLR), Vol. 10, 2022.

[2] J. Antorán, J. Allingham, J. M. Hernández-Lobato, Depth uncertainty in neural networks, Advances in neural information processing systems 33 (2020) 10620-10634.

[3] F. Maleki, K. Ovens, R. Gupta, C. Reinhold, A. Spatz, R. Forghani, Generalizability of machine learning models: quantitative evaluation of three methodological pitfalls, Radiology: Artificial Intelligence 5 (1) (2022) e220028.

[4] A. Mumuni, F. Mumuni, Data augmentation: A comprehensive survey of modern approaches, Array 16 (2022) 100258.

[5] I. Tsamardinos, E. Greasidou, G. Borboudakis, Bootstrapping the out-of-sample predictions for efficient and accurate cross-validation, Machine learning 107 (12) (2018) 1895-1922.

[6] M. Magris, A. Iosifidis, Bayesian learning for neural networks: an algorithmic survey, Artificial Intelligence Review 56 (10) (2023) 11773-11823.

[7] R. Wei, A. Mahmood, Recent advances in variational autoencoders with representation learning for biomedical informatics: A survey, Ieee Access 9 (2020) 4939-4956.

[8] P. Ladosz, L. Weng, M. Kim, H. Oh, Exploration in deep reinforcement learning: A survey, Information Fusion 85 (2022) 1-22.

[9] L. Xiao, Z. Zhang, K. Huang, J. Jiang, Y. Peng, Noise optimization in artificial neural networks, IEEE Transactions on Automation Science and Engineering 22 (2024) 2780-2793.

[10] Y. Liu, S. Liu, Y. Wang, F. Lombardi, J. Han, A survey of stochastic computing neural networks for machine learning applications, IEEE Transactions on Neural Networks and Learning Systems 32 (7) (2020) 2809-2824.
[11] K. Kim, J. Kim, J. Yu, J. Seo, J. Lee, K. Choi, Dynamic energy-accuracy trade-off using stochastic computing in deep neural networks, in: Proceedings of the 53rd Annual Design Automation Conference, 2016, pp. 1–6.

[12] Y. Liu, Y. Wang, F. Lombardi, J. Han, An energy-efficient online-learning stochastic computational deep belief network, IEEE journal on emerging and selected topics in circuits and systems 8 (3) (2018) 454–465.

[13] P. Dahiya, I. Shumailov, R. Anderson, Machine learning needs better randomness standards: Randomised smoothing and {PRNG-based} attacks, in: 33rd USENIX Security Symposium (USENIX Security 24), 2024, pp. 3657–3674.

[14] A. Daniely, G. Vardi, From local pseudorandom generators to hardness of learning, in: Conference on Learning Theory, PMLR, 2021, pp. 1358–1394.

[15] J. Hu, K. Zhu, S. Cheng, N. M. Kovalchuk, A. Soulsby, M. J. Simmons, O. K. Matar, R. Arcucci, Explainable ai models for predicting drop coalescence in microfluidics device, Chemical Engineering Journal 481 (2024) 148465.

[16] K. Zhu, S. Cheng, N. Kovalchuk, M. Simmons, Y.-K. Guo, O. K. Matar, R. Arcucci, Analyzing drop coalescence in microfluidic devices with a deep learning generative model, Physical Chemistry Chemical Physics 25 (23) (2023) 15744–15755.

[17] O. E. Gundersen, K. Coakley, C. Kirkpatrick, Y. Gil, Sources of irreproducibility in machine learning: A review, arXiv preprint arXiv:2204.07610 (2022).

[18] I. M. Sobol', D. Asotsky, A. Kreinin, S. Kucherenko, Construction and comparison of high-dimensional sobol'generators, Wilmott 2011 (56) (2011) 64–79.

[19] R. P. Feynman, Simulating physics with computers, in: Feynman and computation, cRc Press, 2018, pp. 133–153.
[20] T. Cluzel, C. Mazel, D. R. Hill, Quantum computing: a short introduction., Ph.D. thesis, LIMOS (UMR CNRS 6158), université Clermont Auvergne, France; ISIMA diplôme d ... (2019).

[21] M. Matsumoto, T. Nishimura, Mersenne twister: A 623-dimensionally equidistributed uniform pseudo-random number generator, ACM Transactions on Modeling and Computer Simulation 8 (1) (1998) 3–30.

[22] J. K. Salmon, M. A. Moraes, R. O. Dror, D. E. Shaw, Parallel random numbers: As easy as 1, 2, 3, in: Proceedings of the International Conference for High Performance Computing, Networking, Storage and Analysis (SC’11), ACM, 2011, pp. 1–12.

[23] M. E. O’Neill, Pcg: A family of simple fast space-efficient statistically good algorithms for random number generation, ACM Transactions on Mathematical Software[Online]. Available: https://www.cs.hmc.edu/tr/hmc-cs-2014-0905.pdf (2014).

[24] D. E. Knuth, The art of computer programming: Seminumerical algorithms, volume 2, Addison-Wesley Professional, 2014.

[25] A. Rukhin, J. Soto, J. Nechvatal, M. Smid, E. Barker, A statistical test suite for random and pseudorandom number generators for cryptographic applications (2001).

[26] P. L'ecuyer, R. Simard, Testu01: A library for empirical testing of random number generators, ACM Transactions on Mathematical Software (TOMS) 33 (4) (2007) 1–40.

[27] M. Huk, K. Shin, T. Kuboyama, T. Hashimoto, Random number generators in training of contextual neural networks, in: Asian Conference on Intelligent Information and Database Systems, Springer, 2021, pp. 717–730.

[28] A. Koivu, J.-P. Kakko, S. Mäntyniemi, M. Sairanen, Quality of randomness and node dropout regularization for fitting neural networks, Expert Systems with Applications 207 (2022) 117938.

[29] T. H. Click, A. Liu, G. A. Kaminski, Quality of random number generators significantly affects results of monte carlo simulations for organic
and biological systems, Journal of computational chemistry 32 (3) (2011) 513–524.

[30] D. Picard, Torch. manual_seed (3407) is all you need: On the influence of random seeds in deep learning architectures for computer vision, arXiv preprint arXiv:2109.08203 (2021).

[31] P. Madhyastha, R. Jain, On model stability as a function of random seed, arXiv preprint arXiv:1909.10447 (2019).

[32] A. Lebedev, A. Möslein, O. I. Yaman, D. Rajan, P. Intallura, Ef-fects of the entropy source on monte carlo simulations, arXiv preprint arXiv:2409.11539 (2024).

[33] J. J. Bird, A. Ekárt, D. R. Faria, On the effects of pseudo and quantum random number generators in soft computing, arXiv preprint arXiv:1910.04701 (2019).

[34] A. S. Jakob, The pitfalls of pseudo-random numbers in machine learning, 4th year project report, School of Informatics, University of Edinburgh (2022).

[35] H. Zhou, G. Savova, L. Wang, Assessing the macro and micro effects of random seeds on fine-tuning large language models, arXiv preprint arXiv:2503.07329 (2025).

[36] D. R. Hill, B. A. Antunes, Reproductibilité et modèles covid-un modèle multi-agents, in: Journées DEVS Francophones-Convergences entre la Théorie de la Modélisation et de la Simulation et les Systèmes multi-agents, IES Cargèse, France. 2022, 2022.

[37] R. G. Miller Jr, Beyond ANOVA: basics of applied statistics, CRC press, 1997.

[38] W. H. Kruskal, W. A. Wallis, Use of ranks in one-criterion variance analysis, Journal of the American statistical Association 47 (260) (1952) 583–621.