PRNG Analysis

javascript


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

const fs = require('fs');

// Set the number of random numbers to generate and the upper bound for the numbers
const n = 10;
const x = 100;

// Generate N random numbers between 1 and X
const numbers = Array.from({ length: n }, () => Math.floor(Math.random() * x) + 1);

// Calculate the probability of each number
const counts = numbers.reduce((counts, number) => {
  counts[number] = (counts[number] || 0) + 1;
  return counts;
}, {});
const total = numbers.length;
const probabilities = Object.keys(counts).reduce((probabilities, number) => {
  probabilities[number] = counts[number] / total;
  return probabilities;
}, {});

// Generate a file name based on the values of N and X
const fileName = `javascript_${n}_${x}`;

// Create the "outputs" directory if it does not exist
// if (!fs.existsSync('outputs')) {
//   fs.mkdirSync('outputs');
// }

// Write the probabilities to a file in the "outputs" directory
const output = Object.keys(probabilities)
  .map(number => `${number}:${probabilities[number]}`)
  .join('\n');
fs.writeFileSync(`../outputs/${fileName}`, output);