PRNG Analysis

dart


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

import 'dart:io';
import 'dart:math';

void main() {
  // Set the number of random numbers to generate and the upper bound for the numbers
  final x = 1000;
  final n = 1000000;

  // Generate N random numbers between 1 and X
  final random = Random();
  final numbers = List.generate(n, (_) => random.nextInt(x) + 1);

  // Calculate the probability of each number
  final counts = Map<int, int>();
  numbers.forEach((number) => counts[number] = (counts[number] ?? 0) + 1);
  final total = numbers.length;
  final probabilities = counts.entries
      .map((e) => MapEntry(e.key, e.value / total))
      .toList();

  // Generate a file name based on the values of N and X
  final fileName = 'dart_${x}_${n}';

  // Create the "outputs" directory if it does not exist
  // Directory('outputs').create(recursive: true);

  // Write the probabilities to a file in the "outputs" directory
  final file = File('../outputs/$fileName');
  file.writeAsStringSync(probabilities
      .map((e) => '${e.key}:${e.value}\n')
      .join());
}