1. Generación de números pseudoaleatorios

set.seed(1024) 
num_aleat <- runif(100) 
num_aleat
##   [1] 0.218089162 0.987634242 0.348461888 0.381046992 0.020985963 0.749726872
##   [7] 0.162958040 0.319041290 0.597890265 0.587997315 0.017695128 0.958794595
##  [13] 0.351446537 0.454754228 0.981003017 0.180855066 0.847822347 0.855251296
##  [19] 0.681898489 0.491963019 0.030104282 0.386669877 0.107637750 0.486919958
##  [25] 0.877060791 0.767687160 0.501464635 0.296844329 0.461977877 0.579539660
##  [31] 0.963717041 0.647879323 0.093061020 0.800327712 0.391240846 0.720460022
##  [37] 0.228445338 0.927102863 0.142298374 0.389388268 0.363347421 0.869589679
##  [43] 0.789751602 0.906513413 0.945786288 0.078741808 0.926134936 0.173952812
##  [49] 0.448954895 0.988740478 0.294968800 0.694531497 0.652317950 0.373536831
##  [55] 0.810358191 0.377337193 0.204761851 0.803071714 0.768183101 0.096977385
##  [61] 0.253052591 0.333268477 0.640907501 0.055483490 0.844214465 0.678708360
##  [67] 0.406748594 0.600562320 0.912066377 0.424787953 0.394106073 0.466125859
##  [73] 0.846106687 0.300165989 0.389851344 0.866766201 0.268239458 0.793729924
##  [79] 0.308793515 0.112686666 0.438916534 0.170949163 0.888932320 0.302179605
##  [85] 0.251565809 0.338700320 0.113204624 0.781412892 0.847105187 0.693043585
##  [91] 0.727063325 0.354361066 0.284795671 0.165738450 0.186383290 0.530241814
##  [97] 0.005782521 0.245704161 0.722189113 0.368517591

2. Histograma

hist(num_aleat, breaks=6, 
     main="Histograma de números pseudoaleatorios", 
     col="lightblue")

3. Prueba de uniformidad: Chi-cuadrado

library(agricolae)
histo <- hist(num_aleat, breaks=6, plot=FALSE)
Tabla <- table.freq(histo)
obser <- Tabla$Frequency
Ei <- length(num_aleat)/length(obser) 
x2 <- (obser - Ei)^2 / Ei
chi_cuad <- sum(x2)
chi_cuad
## [1] 6.7

4. Prueba de Kolmogorov-Smirnov

ks.test(num_aleat, "punif", 0, 1)
## 
##  Asymptotic one-sample Kolmogorov-Smirnov test
## 
## data:  num_aleat
## D = 0.075894, p-value = 0.6121
## alternative hypothesis: two-sided

5. Prueba de independencia (corridas)

S <- ifelse(diff(num_aleat) > 0, 1, 0)
cambios <- abs(diff(S))
corridas <- sum(cambios) + 1
mu <- (2*length(num_aleat)-1)/3
varianza <- (16*length(num_aleat)-29)/90
Z <- (corridas-mu)/sqrt(varianza)
Z
## [1] 0.3989164

6. Prueba de Póker

library(randtoolbox)
## Cargando paquete requerido: rngWELL
## This is randtoolbox. For an overview, type 'help("randtoolbox")'.
poker.test(num_aleat)
## 
##           Poker test
## 
## chisq stat = 1.5, df = 4, p-value = 0.82
## 
##       (sample size : 100)
## 
##  observed number  0 1 12 6 1 
##  expected number  0.032 1.9 9.6 7.7 0.77

7. Conclusión

De acuerdo con las pruebas (Chi-cuadrado, Kolmogorov-Smirnov, Corridas y Póker), los números generados cumplen con las propiedades de uniformidad e independencia.
Esto significa que se comportan como verdaderamente aleatorios y son adecuados para simulaciones estadísticas.