In: Statistics and Probability
Codes:
n=1337
a=20 #smallest possible value
b=40 #largest possible value
ex5=runif(n,a,b) #sample population
ex5
R-commands and outputs:
#If you want to find sample from Uniform distribution, then
'runif()' command is used.
?runif
n=1337
a=20 #smallest possible value
b=40 #largest possible value
ex5=runif(n,a,b) #sample population
ex5
[1] 37.44443 22.85386 25.55268 34.13867 34.90982 36.41917 20.56688
26.85924
[9] 37.76932 22.11470 39.34171 27.84714 22.44367 26.57907 26.85140
31.50830
[17] 22.22885 28.10780 32.61064 34.50926 23.36941 36.04719 39.83846
21.26678
[25] 26.57805 35.07161 23.10561 22.68608 24.09707 31.98403 29.52706
36.83379
[33] 37.53727 31.59761 34.61546 21.42483 28.19043 25.18436 28.42131
21.38833
[41] 21.27891 23.05206 31.44384 32.87736 37.59773 21.59727 38.47301
24.58911
[49] 25.47827 20.21215 38.24068 25.70032 29.27257 29.27323 33.44064
38.26316
[57] 25.88221 23.78261 28.40826 26.83623 28.80815 32.07568 38.53320
25.32367
[65] 35.99039 24.59172 39.94303 34.71884 23.52079 21.17109 33.49940
26.83850
[73] 33.97350 24.82567 31.96206 21.36764 28.08132 39.65127 34.01644
32.00438
[81] 27.04158 28.02195 26.53884 35.95313 30.94638 38.52088 24.35096
28.66889
[89] 36.15304 28.48404 30.07323 25.93592 23.54465 32.24301 39.85557
36.18259
[97] 34.94877 38.94442 36.48082 36.80778 34.99228 27.86776 35.76428
21.38277
[105] 26.73963 23.80163 21.18547 22.50428 36.99352 20.15951
37.01901 23.80859
[113] 23.12834 24.76001 25.89278 22.93707 25.07090 28.39587
36.15266 28.74398
[121] 22.57940 28.74349 24.08357 38.98871 23.07059 36.79107
39.82127 33.31806
[129] 38.59134 36.46348 21.83258 25.62566 26.55068 39.33589
20.98793 24.32060
[137] 39.79638 28.73898 23.99329 21.05862 31.44803 25.04315
25.85658 38.46368
[145] 20.32649 21.54914 27.96347 33.36582 24.76277 22.79601
20.06381 20.94253
[153] 29.37505 33.82772 20.49141 37.07794 37.33968 29.78357
25.85625 37.32089
[161] 25.01674 27.05278 29.06624 36.77027 28.45000 24.65302
38.93489 27.69723
[169] 24.30233 29.54348 22.95323 30.88987 38.73861 25.79288
25.68628 31.37621
[177] 31.87634 31.49110 35.29177 21.94460 34.54024 28.37343
29.38126 22.78309
[185] 29.55582 28.07775 37.01996 33.43210 35.19681 28.18798
23.02038 26.60082
[193] 29.28589 28.86243 22.99948 38.86935 20.79464 36.32886
39.44997 23.54196
[201] 28.96638 29.19150 20.65665 30.22830 39.30653 39.13352
38.55103 29.98488
[209] 36.39977 20.35511 39.96935 38.33454 27.84070 38.21394
23.29470 22.51232
[217] 34.71697 20.84740 34.88398 34.00978 35.45228 26.48598
39.52329 22.02735
[225] 39.37173 32.38145 23.09224 34.18701 25.02038 30.91378
20.16151 31.99329
[233] 30.19077 28.98500 25.11334 34.77951 27.96658 24.50424
23.57900 35.44592
[241] 39.29078 24.09601 39.52663 37.30604 25.13207 34.07772
31.20068 33.86045
[249] 37.36189 29.24384 25.62552 25.48228 31.76586 31.28247
22.21919 22.56739
[257] 27.80595 23.10111 36.94061 32.77391 23.83434 38.22207
23.19832 27.01408
[265] 38.89751 31.56403 38.05660 29.11508 33.81744 39.59222
22.30596 35.56141
[273] 39.86110 21.75157 36.03136 38.25957 38.93911 35.60989
32.47520 27.11405
[281] 22.59267 36.75376 31.24846 37.02803 38.89316 34.04818
29.49893 22.37712
[289] 34.40515 33.80720 23.58826 32.91664 33.68673 28.79470
34.47944 30.49948
[297] 36.16452 31.30310 24.53917 23.68716 31.04297 27.83724
27.04938 37.38016
[305] 21.17161 21.89368 34.38551 24.43340 30.17351 23.08505
31.09766 30.39043
[313] 33.12646 20.65258 39.33342 35.75745 26.23064 21.56153
23.82032 20.22187
[321] 39.44991 22.90086 22.21043 29.68728 29.30535 29.25914
28.24904 26.26776
[329] 29.19834 22.13565 31.58935 33.43744 37.56794 20.66109
23.59318 22.37299
[337] 36.35814 22.65569 30.17610 38.40981 29.04873 32.27738
30.18281 35.24987
[345] 31.43540 36.97064 32.06979 32.96441 36.74847 27.14375
27.77520 31.58410
[353] 36.92125 23.33675 22.91191 32.73296 32.93730 22.93215
34.80242 37.82609
[361] 22.19181 30.72900 23.20165 29.08877 20.67180 31.03041
31.37516 23.18516
[369] 31.33909 33.66736 28.97468 30.95219 34.73373 38.59329
38.50007 38.94010
[377] 36.13533 25.30760 28.44652 26.90364 24.48732 34.59476
28.55147 36.40310
[385] 34.38121 24.63503 32.28504 20.23850 35.46452 21.50411
31.61796 24.27685
[393] 21.67861 36.36191 38.45245 34.85080 29.17755 31.40656
29.80216 26.08895
[401] 32.49062 23.72859 30.10504 33.51074 23.07780 22.81592
21.16045 28.59223
[409] 22.35108 31.06305 25.39489 20.92713 32.32457 24.32681
22.61372 21.50129
[417] 21.96972 29.95900 21.34590 37.20577 38.54846 29.69923
33.04416 20.91606
[425] 21.78223 39.61180 34.53290 28.49922 28.82962 26.93962
33.15480 24.72876
[433] 27.21629 28.30402 20.53875 29.79679 38.73800 35.39452
37.74127 24.81353
[441] 37.51905 35.21231 32.88950 25.16858 38.85058 29.25829
29.82526 30.51694
[449] 28.59264 37.08665 22.73979 39.49163 21.23666 36.01118
34.07031 39.16488
[457] 29.62652 20.35646 33.75840 21.77665 32.22942 28.45146
29.70191 32.25130
[465] 20.21373 38.37366 32.80108 33.16846 39.53944 28.65446
26.18018 32.39644
[473] 29.16276 37.52054 36.52295 32.22974 39.80000 21.77970
21.58355 39.58537
[481] 21.71593 32.63707 21.46804 34.83216 20.72023 35.10163
24.25059 38.68376
[489] 34.44688 38.76794 36.10186 36.53047 24.08467 27.01854
30.13879 37.83632
[497] 34.66499 27.81906 28.58506 20.88785 29.48370 29.80383
35.99428 36.62422
[505] 22.80741 33.05250 37.73232 33.88693 37.92592 27.93910
25.19136 21.55313
[513] 24.10525 29.16843 38.10172 21.13606 33.76516 24.49635
29.61880 31.57998
[521] 35.42522 24.16056 35.49578 24.13858 36.41007 23.73303
34.74091 33.88964
[529] 29.58057 25.65051 36.40212 26.47968 37.87736 38.09849
27.53750 30.50756
[537] 23.84222 34.47955 29.69079 38.63576 38.15263 25.68463
37.95311 30.29232
[545] 25.91672 29.89303 30.48015 25.52345 36.32759 29.61717
31.78119 21.18619
[553] 35.60707 22.91428 23.52210 38.04122 25.56117 31.63510
23.42024 26.66518
[561] 37.15889 27.86417 27.29400 38.66633 23.28238 23.54004
33.37558 36.14089
[569] 36.55267 20.02563 39.63175 21.29302 29.27912 27.70796
39.49817 25.92554
[577] 38.41770 38.95234 24.42464 35.46473 31.60514 24.65128
20.46599 39.60276
[585] 22.88668 27.20770 32.93586 39.82962 33.94778 36.79857
35.33639 36.19661
[593] 26.61333 24.52980 31.51137 37.60312 32.47763 20.54906
22.28286 29.29924
[601] 21.56360 21.68786 33.35448 29.16745 39.50329 20.05162
28.43792 22.23526
[609] 29.12429 37.87654 27.65988 37.90405 26.76173 33.51723
30.47122 27.88095
[617] 24.40962 20.19335 33.45784 34.33914 21.93938 24.88883
39.92386 31.40882
[625] 25.41609 22.80910 21.08938 34.97072 22.57117 26.45379
38.57337 24.53766
[633] 27.36127 20.41018 39.82809 37.14036 39.21047 21.53487
24.46681 35.30406
[641] 24.09289 20.09691 31.84607 26.39351 20.59315 25.54435
37.18907 29.02453
[649] 35.88184 32.36370 33.42627 28.52034 39.44867 33.92641
31.67157 23.96080
[657] 24.37775 33.46176 22.20205 34.09331 30.23887 38.31840
32.88380 28.63997
[665] 29.18877 21.63467 36.01602 39.39629 31.45394 32.50051
37.23939 36.14716
[673] 33.03062 21.23595 23.69804 39.89051 34.56999 23.23460
23.31375 34.06042
[681] 29.12595 31.21263 30.78908 35.79161 35.24239 26.16952
38.51852 20.50507
[689] 23.83241 35.53306 35.89460 27.06428 35.41782 36.80620
21.11190 36.69192
[697] 30.61045 34.41466 20.87253 32.20716 26.84875 25.28345
32.86431 37.29685
[705] 20.20030 27.37351 28.76394 24.11564 29.60962 26.70421
39.96367 22.54126
[713] 23.19974 26.00337 35.68549 20.63443 30.99604 25.27397
21.81258 26.03377
[721] 38.82823 21.09273 37.11210 39.52376 38.91409 24.07311
36.22817 27.34863
[729] 36.82031 20.59657 31.18145 28.05304 22.64806 34.86221
34.80773 31.53400
[737] 38.62999 38.98056 23.93133 34.03822 24.50354 37.15181
20.70047 23.50853
[745] 39.85570 23.53799 30.89024 24.88017 24.45723 34.54515
34.87022 36.76908
[753] 31.58437 31.24125 28.34487 39.58245 38.63137 30.93409
37.09380 28.37570
[761] 27.08861 22.59606 38.02035 30.41724 32.45914 38.36526
21.97138 37.97500
[769] 33.02356 25.99820 37.67948 23.31689 25.22015 32.36687
37.27254 20.14801
[777] 35.08701 32.67971 31.42847 36.89013 24.76980 32.68052
22.72011 27.46789
[785] 30.10893 24.39622 28.09162 31.83347 37.70442 25.88295
25.74656 31.93362
[793] 27.90208 23.08321 37.54785 24.20398 21.46075 34.73997
20.22751 28.58154
[801] 34.72618 25.49856 26.92991 36.61006 33.07982 25.30269
32.51977 25.85076
[809] 30.67763 32.96125 31.13802 22.58165 26.76705 36.28934
33.15781 28.48066
[817] 28.74532 31.63017 30.45668 24.66846 32.81047 29.14478
26.53111 20.85640
[825] 38.53957 36.75269 27.85120 36.05165 36.54355 35.93270
37.02188 38.90271
[833] 28.94870 33.99993 24.22206 21.28919 35.09731 20.18909
37.41793 32.23470
[841] 28.64459 24.20003 34.55885 36.44480 30.06174 37.45690
27.51994 35.26520
[849] 24.36186 21.10115 37.01030 33.18732 33.73682 21.73027
21.91320 35.05487
[857] 29.77307 21.79907 33.20808 33.69677 34.62124 21.39256
37.03454 29.12984
[865] 29.49949 30.23337 33.96697 26.74204 21.70528 34.93218
29.96494 32.10977
[873] 39.31565 35.15921 25.94789 21.16661 27.95536 29.49747
23.58082 26.71328
[881] 28.38510 31.20938 32.35902 30.52439 31.04716 33.89139
31.15589 25.71266
[889] 21.77425 37.92777 39.61656 29.32532 35.73724 33.90509
31.84473 33.01428
[897] 37.97387 31.67207 22.80847 20.12994 32.57108 23.82522
28.47988 33.75984
[905] 21.18193 38.66008 32.20909 23.33823 26.53705 26.86717
21.72864 36.22529
[913] 39.61719 31.54254 26.60391 31.76456 31.14545 28.66534
36.40379 26.56496
[921] 32.52424 33.44114 32.09175 25.20265 20.73516 28.96287
39.29134 24.10875
[929] 24.46763 37.49762 31.45933 30.77973 24.30688 39.80223
32.33684 22.55371
[937] 33.76038 24.05287 24.53912 31.99174 34.46715 23.07533
25.65917 34.33527
[945] 34.83023 20.11926 35.97845 35.21181 26.24506 21.58586
31.04475 21.54089
[953] 30.16375 39.29331 37.30598 27.73148 38.22806 38.26464
26.34984 28.42113
[961] 29.16855 22.55105 29.42034 22.72920 24.12290 24.38911
38.82333 30.50651
[969] 29.82550 29.96872 20.55303 25.27960 27.75875 20.95490
35.82133 37.42117
[977] 28.08053 28.22594 27.04300 24.04042 20.12749 25.91210
23.13887 33.04988
[985] 38.50262 30.64858 25.43747 39.41031 39.32143 29.83096
20.64043 31.45061
[993] 21.69129 29.50969 23.91762 38.62675 33.22250 21.20839
38.05674 34.95600
[1001] 38.39479 32.11708 34.95710 22.73206 22.59576 37.22813
34.69818 28.82297
[1009] 35.41819 34.10824 31.55014 33.10897 37.77678 24.95666
21.85024 39.36932
[1017] 28.65620 27.83494 24.43920 29.61697 23.24833 30.26902
32.91625 29.32109
[1025] 35.32541 34.45053 39.92464 30.79728 36.62053 34.78728
31.40599 32.72442
[1033] 33.09633 24.79033 21.60704 38.29882 20.76691 27.55235
35.12598 34.13183
[1041] 27.03168 36.02811 32.86910 35.75388 35.51096 23.55336
35.36400 24.57194
[1049] 23.99569 39.51837 33.51999 29.83288 25.04258 21.89462
23.63260 38.66895
[1057] 33.49688 20.85231 28.86279 30.34891 24.78983 34.03514
38.27635 33.04594
[1065] 24.84552 22.53045 24.29679 38.21325 37.72524 20.51006
23.43805 22.21896
[1073] 26.25589 24.76753 32.83814 39.81002 28.25109 31.47877
33.70522 24.45579
[1081] 22.80899 37.70312 33.96223 38.65004 26.46088 29.35877
31.45447 25.63523
[1089] 21.08310 30.13768 25.37489 38.87555 34.10125 35.25781
39.15724 27.90122
[1097] 29.53235 34.00479 39.55342 20.14550 36.77899 24.39820
22.31366 27.82254
[1105] 38.02076 25.32467 31.36218 37.78026 22.80289 37.83981
37.26864 22.96660
[1113] 36.43987 36.43055 29.23215 35.59282 26.01707 37.13368
35.12031 27.63642
[1121] 24.86702 28.51020 20.82562 33.88718 36.31039 32.13378
23.56884 38.41072
[1129] 31.55738 38.68272 31.32859 21.10607 21.06874 24.16004
28.36673 37.17669
[1137] 38.78827 24.98751 36.30919 31.69178 24.31432 26.73982
31.06279 36.17664
[1145] 31.95933 26.90716 20.72190 28.68175 33.99154 33.78261
39.86288 25.09656
[1153] 27.41881 23.99574 36.95749 26.36974 33.85454 34.13124
28.13720 35.98422
[1161] 20.99135 22.36977 25.41853 27.58991 33.39912 20.88014
23.31223 33.28288
[1169] 23.27700 35.67931 32.90790 28.11872 20.09869 35.85434
32.76202 28.32212
[1177] 30.30408 39.65505 27.58790 31.89169 32.03168 34.47239
24.87609 29.16533
[1185] 23.62791 26.42265 28.11766 35.36951 39.97243 31.62841
29.64581 39.07407
[1193] 27.67318 30.02042 38.98853 29.87248 23.93979 37.76178
26.76621 24.29434
[1201] 38.17098 32.45913 22.79323 32.87858 38.98798 39.00154
33.95487 25.28406
[1209] 22.08588 21.92996 20.42805 25.33250 39.98708 30.06389
25.58187 34.21931
[1217] 33.25182 25.45734 22.30007 24.20658 38.75073 24.98213
37.70569 32.18502
[1225] 30.95213 36.66916 34.55917 22.78608 36.89627 39.48784
39.12049 26.83576
[1233] 25.21898 38.72326 21.08520 30.49115 37.85975 23.38665
37.32009 21.86530
[1241] 34.48158 21.99407 20.95294 20.33925 31.71479 37.24950
30.71276 33.51342
[1249] 33.24450 28.51889 32.53142 29.02925 35.09964 24.29915
39.57482 38.64853
[1257] 36.67884 21.62433 21.50714 26.52948 23.24929 27.30778
35.34853 29.59355
[1265] 28.41244 25.80244 26.74214 32.88465 35.42265 26.68940
34.43989 30.79127
[1273] 34.65353 24.00663 21.49609 27.88370 36.29090 36.09146
33.89853 32.14439
[1281] 23.05061 30.06283 30.27128 24.80362 32.58015 22.37614
34.44332 21.25279
[1289] 26.83810 33.14457 29.18074 25.86872 30.82423 31.53291
31.68783 21.06251
[1297] 34.77903 21.58715 20.66450 33.16818 26.86168 28.29369
28.69470 31.46163
[1305] 33.93343 22.55652 20.94859 34.11536 28.61642 23.64505
28.14299 21.36677
[1313] 34.93466 33.77715 31.12821 32.71393 38.52447 35.27184
28.63301 22.35876
[1321] 25.59009 29.51975 39.73482 29.41396 29.32627 21.50208
30.47584 23.41889
[1329] 23.56632 21.16424 21.23188 31.29446 23.01665 24.72118
27.59242 24.45668
[1337] 36.58423
mean(ex5)
[1] 29.98415
min(ex5) #smallest value from the sample
[1] 20.02563
max(ex5) #largest value from the sample
[1] 39.98708