PRNG Analysis

ruby


74:0.000986
269:0.000944
3:0.001017
292:0.000989
34:0.000959
260:0.00102
173:0.000983
590:0.000972
370:0.001009
687:0.000998
854:0.001039
964:0.000981
437:0.001059
711:0.000993
740:0.000962
290:0.001017
972:0.000995
604:0.001072
799:0.000951
663:0.000997
314:0.00104
888:0.001003
801:0.000997
898:0.000979
761:0.001003
78:0.000967
692:0.000993
380:0.000978
756:0.000987
464:0.001007
415:0.00095
159:0.000978
921:0.001056
239:0.001034
824:0.000998
709:0.001026
840:0.000976
594:0.001026
521:0.000991
355:0.001014
21:0.001032
194:0.00096
550:0.000989
259:0.000999
445:0.000983
93:0.000994
766:0.001007
644:0.000961
675:0.000999
418:0.000999
483:0.000973
165:0.000968
377:0.000983
741:0.001054
455:0.001036
936:0.000977
15:0.000962
672:0.001027
805:0.00099
358:0.000995
474:0.000994
160:0.001002
648:0.001024
812:0.000989
452:0.000954
662:0.000939
152:0.000968
486:0.000998
688:0.001053
549:0.001028
943:0.000983
652:0.000957
430:0.001011
941:0.000952
768:0.00099
925:0.000992
405:0.000954
163:0.000983
608:0.000958
139:0.000949
988:0.000999
942:0.00103
56:0.001013
579:0.001006
322:0.001005
968:0.00103
329:0.000985
891:0.000979
311:0.000991
141:0.00097
514:0.001
368:0.001034
674:0.001028
653:0.000968
100:0.000977
143:0.000957
684:0.000996
420:0.000959
949:0.000982
987:0.001032
825:0.001011
793:0.001017
37:0.001018
646:0.001019
397:0.001041
565:0.001004
867:0.00101
480:0.00103
744:0.000969
846:0.001004
227:0.00097
573:0.00101
32:0.000967
922:0.001001
166:0.00103
20:0.00103
477:0.00097
580:0.000947
490:0.000995
994:0.000998
266:0.000991
388:0.001018
892:0.000992
236:0.001052
339:0.001034
658:0.001024
112:0.000962
72:0.001031
657:0.00098
700:0.001026
917:0.000949
25:0.000956
555:0.001031
392:0.000988
668:0.001023
237:0.000946
639:0.000998
660:0.000965
822:0.001013
777:0.000987
363:0.001005
931:0.001012
396:0.001003
787:0.001021
357:0.001042
279:0.001021
428:0.001014
827:0.001036
447:0.000953
416:0.00103
201:0.00097
156:0.001071
45:0.001058
345:0.00099
69:0.000988
491:0.000997
703:0.000982
439:0.001025
331:0.001021
820:0.000985
871:0.000965
656:0.001059
776:0.001018
796:0.001024
466:0.000954
946:0.000968
424:0.000957
929:0.000981
906:0.000958
75:0.001017
895:0.001003
562:0.001036
347:0.001005
257:0.001002
992:0.001008
356:0.000994
599:0.001001
361:0.001037
300:0.001065
193:0.001007
912:0.000979
627:0.001024
262:0.001009
205:0.001023
636:0.000996
316:0.001023
773:0.001002
789:0.000998
169:0.000992
251:0.001
903:0.001009
923:0.000982
109:0.001039
938:0.00103
240:0.000992
621:0.001023
453:0.000955
990:0.001026
508:0.001001
317:0.001021
734:0.000976
951:0.001023
694:0.001009
186:0.001011
661:0.001
134:0.000976
695:0.001008
13:0.001014
450:0.000946
685:0.001044
385:0.000996
44:0.001041
436:0.001004
506:0.001024
928:0.001006
196:0.000994
839:0.000979
979:0.000992
502:0.001037
412:0.001
272:0.001
567:0.001025
471:0.000975
748:0.001002
29:0.001028
65:0.000967
710:0.00105
364:0.000989
188:0.001026
574:0.00098
138:0.000972
47:0.000957
440:0.001033
828:0.000949
369:0.001025
819:0.001071
973:0.000977
747:0.00097
460:0.000928
586:0.00099
469:0.001004
767:0.00096
376:0.000981
119:0.001021
858:0.000959
837:0.001037
117:0.001045
905:0.001012
953:0.001012
213:0.001009
823:0.001044
690:0.001028
360:0.001033
268:0.001031
934:0.001004
780:0.001029
495:0.001002
128:0.000967
589:0.001021
786:0.000972
638:0.001026
301:0.000969
689:0.000994
704:0.001013
461:0.001
894:0.000998
750:0.000994
243:0.000972
296:0.001001
852:0.000972
980:0.000934
297:0.001024
221:0.001025
967:0.001037
955:0.000998
48:0.001044
476:0.000983
603:0.000964
273:0.000973
811:0.001022
161:0.001071
220:0.00099
875:0.001049
724:0.001008
254:0.001007
889:0.001002
969:0.000932
144:0.000984
896:0.000998
759:0.001083
216:0.000983
52:0.000997
727:0.000994
719:0.000986
743:0.000979
387:0.001035
535:0.000987
986:0.001013
438:0.000999
467:0.001079
214:0.000987
458:0.000979
401:0.000985
133:0.001056
524:0.001002
222:0.000976
511:0.000972
1000:0.000977
349:0.000977
114:0.000981
76:0.000926
804:0.000978
971:0.001012
736:0.00101
844:0.001027
323:0.000965
35:0.001019
226:0.001025
328:0.001001
960:0.000996
206:0.000941
129:0.001012
913:0.001001
80:0.001028
708:0.000986
635:0.001032
569:0.001001
620:0.000968
691:0.001019
335:0.000951
261:0.001009
51:0.001031
995:0.001003
605:0.001063
954:0.001006
181:0.001013
248:0.000988
588:0.001001
765:0.001017
584:0.000998
717:0.00101
8:0.001012
126:0.001035
333:0.000931
932:0.001026
492:0.000975
232:0.001029
577:0.001018
298:0.000993
832:0.000966
634:0.000959
860:0.000977
667:0.000988
291:0.00098
235:0.000975
59:0.000973
619:0.000966
151:0.00096
132:0.001009
792:0.001018
137:0.000994
544:0.000976
334:0.000995
571:0.00102
728:0.00099
393:0.000935
518:0.000999
88:0.000974
881:0.001009
753:0.000991
456:0.000963
164:0.000996
829:0.000971
849:0.001012
908:0.00101
686:0.000979
516:0.000997
320:0.000985
609:0.001014
255:0.000993
102:0.00093
613:0.001014
853:0.00101
596:0.001032
348:0.000958
497:0.00105
649:0.001046
19:0.000981
308:0.001038
598:0.001024
501:0.001012
902:0.00098
833:0.000984
238:0.001017
650:0.001035
910:0.000982
593:0.000934
682:0.001005
177:0.001013
195:0.000949
557:0.001046
977:0.000949
332:0.001008
915:0.001071
749:0.000999
89:0.001038
77:0.000947
481:0.001013
536:0.000984
28:0.001011
611:0.000946
53:0.001001
874:0.001004
158:0.001038
182:0.000999
446:0.001008
699:0.001
475:0.000983
556:0.000962
838:0.000999
911:0.00104
315:0.001008
6:0.000982
46:0.000984
607:0.000966
247:0.000959
959:0.001023
520:0.001053
2:0.000981
640:0.000998
963:0.001002
275:0.001029
391:0.000989
862:0.001028
655:0.001035
253:0.000985
564:0.000993
95:0.000966
809:0.001007
60:0.001025
256:0.000973
309:0.001021
877:0.001031
551:0.000997
282:0.001018
772:0.001064
664:0.00106
879:0.001086
924:0.000989
179:0.00101
271:0.001029
49:0.001032
836:0.001017
210:0.001047
729:0.00104
174:0.000995
402:0.00099
715:0.001027
526:0.001005
847:0.000992
542:0.001034
563:0.001014
558:0.001024
204:0.001033
121:0.001019
122:0.000987
887:0.001044
770:0.001031
390:0.000938
602:0.000987
375:0.00096
66:0.001039
38:0.000974
505:0.000984
184:0.000988
118:0.001016
359:0.001048
578:0.000998
982:0.000981
529:0.000955
626:0.001008
730:0.000954
532:0.000996
616:0.000955
496:0.000992
63:0.001007
289:0.001016
258:0.001059
352:0.000997
998:0.000972
869:0.000994
956:0.000998
394:0.00098
127:0.000988
324:0.001015
327:0.001019
374:0.001014
104:0.000935
342:0.000991
299:0.000971
702:0.000995
18:0.000946
90:0.001034
774:0.001
409:0.000967
962:0.000936
185:0.001004
615:0.000975
97:0.000966
882:0.001024
26:0.000981
200:0.001042
845:0.001015
707:0.001047
27:0.000955
287:0.001011
624:0.001039
340:0.001052
136:0.00101
350:0.000978
865:0.001011
976:0.001038
84:0.001025
533:0.000993
612:0.000953
737:0.001017
81:0.000994
952:0.001022
930:0.000968
628:0.00097
373:0.000975
442:0.001013
113:0.001063
651:0.000963
422:0.001018
783:0.000918
798:0.000997
856:0.001048
199:0.000999
99:0.001041
105:0.001055
344:0.001018
190:0.000964
591:0.000988
948:0.000959
857:0.00098
552:0.00099
713:0.000978
678:0.00101
975:0.000937
637:0.000998
918:0.000998
403:0.000998
940:0.001028
534:0.001048
754:0.00101
883:0.000995
807:0.001041
920:0.001001
575:0.000993
326:0.001076
916:0.000983
217:0.000972
285:0.001026
961:0.000945
270:0.000997
341:0.001
468:0.001034
346:0.001003
617:0.001026
395:0.000994
897:0.00099
330:0.000996
400:0.001009
379:0.001064
531:0.000967
680:0.001002
10:0.000989
958:0.000995
507:0.001025
303:0.001039
417:0.00105
304:0.000975
410:0.000952
944:0.000968
319:0.001052
540:0.001008
411:0.00105
642:0.000975
981:0.001022
7:0.000974
94:0.000983
566:0.001051
989:0.001063
945:0.000989
870:0.000947
864:0.000993
336:0.001002
283:0.000969
585:0.001026
108:0.001071
762:0.001065
764:0.001032
294:0.000962
758:0.000994
202:0.000981
425:0.00104
431:0.001025
848:0.001035
999:0.001011
843:0.000948
407:0.001005
545:0.001011
91:0.000993
40:0.001056
92:0.000994
83:0.000989
970:0.000977
192:0.000944
246:0.000996
343:0.000975
693:0.000992
473:0.001001
293:0.000946
479:0.001003
559:0.001047
11:0.001016
1:0.00094
701:0.000996
485:0.001022
444:0.000949
983:0.001039
171:0.000962
432:0.001001
383:0.000938
443:0.00096
209:0.001009
830:0.001031
198:0.001042
96:0.000967
295:0.001055
512:0.000966
371:0.001014
457:0.000995
68:0.000988
229:0.000957
71:0.001035
33:0.000975
155:0.001022
484:0.001036
362:0.001054
178:0.000963
472:0.000972
131:0.001042
30:0.001004
4:0.001064
659:0.001013
215:0.000958
673:0.001031
683:0.00095
277:0.000997
337:0.00102
985:0.000982
745:0.000991
366:0.000982
191:0.000993
978:0.000993
389:0.001026
504:0.000996
570:0.000968
523:0.001005
779:0.00098
654:0.001028
884:0.000943
79:0.001038
140:0.001016
354:0.001006
722:0.001029
816:0.001016
742:0.000992
399:0.000972
167:0.000995
62:0.000975
353:0.001029
61:0.000937
398:0.001007
493:0.000959
22:0.000987
733:0.000995
423:0.000969
714:0.000979
381:0.001014
583:0.000998
421:0.001002
130:0.000936
850:0.001022
263:0.000986
12:0.000991
280:0.001007
414:0.000969
826:0.000987
427:0.001002
265:0.001019
926:0.001037
554:0.000963
41:0.00102
671:0.000977
984:0.001005
876:0.000993
70:0.001013
98:0.000968
231:0.001015
933:0.000982
245:0.000984
625:0.00096
135:0.001036
459:0.001006
172:0.001056
413:0.001019
31:0.001051
814:0.000999
803:0.000965
218:0.000995
176:0.001007
947:0.001007
538:0.001016
527:0.000951
581:0.001039
610:0.001051
782:0.000989
587:0.001037
582:0.000973
212:0.000965
755:0.001028
855:0.001019
712:0.000997
939:0.000988
808:0.001035
784:0.001044
950:0.001008
778:0.001006
338:0.001028
993:0.000987
771:0.001002
435:0.001053
996:0.000986
434:0.000978
110:0.000997
50:0.000965
509:0.000966
17:0.000994
821:0.001016
788:0.000992
242:0.000948
86:0.001002
528:0.001015
162:0.001024
597:0.001017
813:0.00103
739:0.001015
73:0.000942
154:0.000978
23:0.000994
87:0.001032
426:0.000966
9:0.00095
738:0.000992
115:0.001058
241:0.001001
935:0.001006
150:0.001062
592:0.001004
614:0.00096
886:0.001003
841:0.000972
111:0.000969
716:0.000986
907:0.001043
43:0.001003
601:0.000969
386:0.001003
725:0.000956
170:0.000974
775:0.001054
539:0.000988
325:0.001
123:0.000936
834:0.001028
859:0.001006
794:0.001003
482:0.001039
568:0.000977
720:0.000998
103:0.001038
145:0.001044
284:0.000966
101:0.00105
244:0.001053
731:0.000987
230:0.00102
488:0.000982
530:0.001026
42:0.001025
384:0.000989
861:0.000964
937:0.001033
974:0.000979
705:0.00101
228:0.000963
14:0.001003
696:0.001001
769:0.001004
142:0.001009
757:0.000996
525:0.001038
927:0.00102
723:0.001028
622:0.001022
546:0.000963
802:0.001012
55:0.00099
85:0.001017
623:0.000989
406:0.000972
537:0.001002
726:0.000933
168:0.000968
629:0.001064
899:0.00102
835:0.001026
39:0.000947
547:0.001006
183:0.001044
382:0.001083
901:0.000936
146:0.000994
16:0.001025
872:0.000913
810:0.000993
449:0.000978
606:0.000969
499:0.000988
666:0.001009
817:0.001011
572:0.000993
631:0.00097
679:0.000997
997:0.000956
669:0.000974
866:0.000977
278:0.001019
595:0.001022
795:0.000977
249:0.001036
203:0.001039
991:0.001025
58:0.001018
561:0.001004
647:0.00099
517:0.001015
463:0.001045
433:0.001016
630:0.000981
548:0.000992
153:0.001013
815:0.001056
560:0.001024
224:0.001015
478:0.001051
500:0.000993
276:0.000983
149:0.001009
408:0.000974
842:0.001035
718:0.001006
67:0.000995
576:0.001019
321:0.000978
207:0.000916
487:0.001028
36:0.001012
900:0.001059
760:0.00102
107:0.000998
175:0.000989
863:0.000973
233:0.001009
454:0.001017
54:0.001008
305:0.001066
310:0.001043
451:0.001026
116:0.000999
831:0.001022
180:0.000982
312:0.001019
318:0.001
800:0.00103
515:0.000976
721:0.001016
806:0.000957
281:0.001027
818:0.000979
878:0.000995
462:0.000968
465:0.001038
470:0.001001
306:0.000969
513:0.000985
187:0.00095
5:0.000981
148:0.001019
632:0.000999
791:0.001016
448:0.000994
893:0.000994
252:0.000973
367:0.001057
125:0.001032
24:0.000964
519:0.00104
919:0.00101
600:0.001026
676:0.00104
665:0.000911
751:0.000977
197:0.001041
785:0.001034
313:0.000958
189:0.001023
351:0.000982
752:0.000942
211:0.001049
429:0.001006
274:0.001011
797:0.001008
735:0.000986
286:0.001
763:0.001052
250:0.000959
543:0.000963
698:0.001006
885:0.001006
441:0.001061
365:0.000999
677:0.000974
706:0.000954
965:0.000966
219:0.001042
957:0.000937
372:0.000983
868:0.001009
503:0.000958
890:0.000995
223:0.001013
553:0.000941
57:0.001011
618:0.000986
267:0.001
670:0.000981
909:0.001021
904:0.000952
498:0.000946
914:0.001006
264:0.001042
288:0.00096
124:0.001
494:0.001025
302:0.00094
645:0.000944
157:0.000981
851:0.001019
633:0.000977
120:0.000916
522:0.001003
790:0.001
106:0.00103
489:0.000969
234:0.001011
307:0.001035
419:0.00099
873:0.001068
82:0.000998
746:0.000954
697:0.000963
541:0.000987
404:0.001018
510:0.000975
64:0.001016
732:0.000975
225:0.001002
208:0.001009
966:0.000978
643:0.001
378:0.000929
147:0.001008
641:0.00099
681:0.000987
880:0.001011
781:0.001015
5:0.099996568
7:0.10000732
9:0.100001776
2:0.099989668
1:0.100015928
3:0.099989378
4:0.099986761
8:0.100004244
6:0.100001423
10:0.100006934
1:0.100302
6:0.099759
3:0.099942
8:0.099848
7:0.099831
5:0.099688
2:0.100167
10:0.100429
9:0.100097
4:0.099937

# Set the number of random numbers to generate and the upper bound for the numbers
n = 1000000000
x = 10

# Generate N random numbers between 1 and X
random = Random.new
numbers = n.times.map { random.rand(1..x) }

# Calculate the probability of each number
counts = numbers.each_with_object(Hash.new(0)) { |number, hash| hash[number] += 1 }
total = numbers.count
probabilities = counts.map { |number, count| [number, count.to_f / total] }.to_h

# Generate a file name based on the values of N and X
file_name = "ruby_#{x}_#{n}"

# Create the "outputs" directory if it does not exist
# Dir.mkdir("outputs") unless Dir.exists?("outputs")

# Write the probabilities to a file in the "outputs" directory
File.open("../outputs/#{file_name}", "w") do |file|
  probabilities.each do |number, probability|
    file.puts "#{number}:#{probability}"
  end
end