3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function addRandomToN($n, $m) { $plus = mt_rand(0,1); if ($plus) { return $n + (($n*$m) * rand0To1()); } return $n - (($n*$m) * rand0To1()); } function rand0To1() { return (float)rand()/(float)getrandmax(); } echo addRandomToN(5, 0.1);
Output for 7.1.0
4.8439211562946
Output for 7.0.14
4.8415317569587
Output for 7.0.12
5.215370000906
Output for 7.0.6
5.0758963835313
Output for 7.0.5
4.7867372610079
Output for 7.0.4
4.9851597959572
Output for 7.0.3
4.8969351632506
Output for 7.0.2
4.6758766689691
Output for 7.0.1
4.6021407638221
Output for 7.0.0
5.0687020346842
Output for hhvm-3.12.0
4.548299983632
Output for hhvm-3.10.0
4.793101450332
Output for 5.6.28
4.5619882734315
Output for 5.6.21
5.164475799382
Output for 5.6.20
5.0155246027352
Output for 5.6.19
4.8346306725101
Output for 5.6.18
4.5784172779314
Output for 5.6.17
4.7589067415143
Output for 5.6.16
4.568736079181
Output for 5.6.15
4.9039583671391
Output for 5.6.14
4.5604999505731
Output for 5.6.13
5.0572156263782
Output for 5.6.12
4.6355355489699
Output for 5.6.11
4.8688805167884
Output for 5.6.10
5.3588130869245
Output for 5.6.9
4.6021537387754
Output for 5.6.8
5.1548697688407
Output for 5.6.7
5.131952765692
Output for 5.6.6
5.4518827509377
Output for 5.6.5
5.2588342932327
Output for 5.6.4
5.083131460046
Output for 5.6.3
4.9802930480709
Output for 5.6.2
5.0173799807752
Output for 5.6.1
5.1236127077712
Output for 5.6.0
5.4085435887838
Output for 5.5.35
5.3357341568152
Output for 5.5.34
5.2408655410357
Output for 5.5.33
4.9585334937826
Output for 5.5.32
4.9062542684405
Output for 5.5.31
4.9462682825729
Output for 5.5.30
5.38336141891
Output for 5.5.29
5.3285162171016
Output for 5.5.28
4.525627703185
Output for 5.5.27
5.0109680595393
Output for 5.5.26
5.0870735159084
Output for 5.5.25
4.7072641317301
Output for 5.5.24
5.3733186837627
Output for 5.5.23
4.5759619982336
Output for 5.5.22
4.8876402009687
Output for 5.5.21
5.3129635238149
Output for 5.5.20
5.3836905438843
Output for 5.5.19
5.4054611455209
Output for 5.5.18
5.3799691509362
Output for 5.5.16
5.3424357789766
Output for 5.5.15
4.7591200316134
Output for 5.5.14
5.3524557572568
Output for 5.5.13
4.7293617523878
Output for 5.5.12
5.3360637169499
Output for 5.5.11
4.9564227170574
Output for 5.5.10
5.0602957459913
Output for 5.5.9
5.0299794224696
Output for 5.5.8
4.6005091029687
Output for 5.5.7
5.1588787947124
Output for 5.5.6
4.8878649738095
Output for 5.5.5
4.9060345945908
Output for 5.5.4
5.0366141314323
Output for 5.5.3
5.2292847452822
Output for 5.5.2
4.5394413634387
Output for 5.5.1
5.3952990818747
Output for 5.5.0
5.4948140538739
Output for 5.4.45
5.3137621198845
Output for 5.4.44
4.9200640194677
Output for 5.4.43
4.9906115191945
Output for 5.4.42
4.7715568422673
Output for 5.4.41
4.7838726838976
Output for 5.4.40
5.2156932415514
Output for 5.4.39
5.3822756821207
Output for 5.4.38
5.2988380062388
Output for 5.4.37
4.8415990901839
Output for 5.4.36
5.4111640804499
Output for 5.4.35
5.4706560307977
Output for 5.4.34
5.4405999046008
Output for 5.4.32
5.2506635637258
Output for 5.4.31
5.1736487297684
Output for 5.4.30
4.8450107638934
Output for 5.4.29
5.3491815642217
Output for 5.4.28
5.4484345263096
Output for 5.4.27
4.5516824911124
Output for 5.4.26
5.4907139392992
Output for 5.4.25
5.2637837663124
Output for 5.4.24
4.6003239248415
Output for 5.4.23
5.1264792108566
Output for 5.4.22
4.7690491412156
Output for 5.4.21
5.0138547960733
Output for 5.4.20
4.6932726640689
Output for 5.4.19
5.4486856634955
Output for 5.4.18
4.7794876987019
Output for 5.4.17
5.0244495549819
Output for 5.4.16
5.3056912675061
Output for 5.4.15
4.6582552560876
Output for 5.4.14
4.6932477002001
Output for 5.4.13
5.0825027402409
Output for 5.4.12
5.4392984548767
Output for 5.4.11
4.8453740968115
Output for 5.4.10
5.1355235302521
Output for 5.4.9
4.9553863275588
Output for 5.4.8
5.1347974809514
Output for 5.4.7
5.1744181582119
Output for 5.4.6
5.0872610987105
Output for 5.4.5
5.2131427289979
Output for 5.4.4
4.9214040038276
Output for 5.4.3
5.4708646393711
Output for 5.4.2
5.2353512548075
Output for 5.4.1
4.8897951272734
Output for 5.4.0
4.95035640148
Output for 5.3.29
4.8339871593444
Output for 5.3.28
4.8666736306002
Output for 5.3.27
5.3296058195781
Output for 5.3.26
5.3690878266325
Output for 5.3.25
4.9782100203346
Output for 5.3.24
5.4524266004807
Output for 5.3.23
5.3073046849143
Output for 5.3.22
4.8431602033522
Output for 5.3.21
5.3515561899876
Output for 5.3.20
5.4060328348568
Output for 5.3.19
4.9695046017736
Output for 5.3.18
5.2994475484823
Output for 5.3.17
4.8411794408882
Output for 5.3.16
4.729551131944
Output for 5.3.15
4.6640744536016
Output for 5.3.14
5.2265638616991
Output for 5.3.13
5.088304399321
Output for 5.3.12
4.8726303539577
Output for 5.3.11
5.4066807666825
Output for 5.3.10
4.8228058816506
Output for 5.3.9
4.9686101151018
Output for 5.3.8
4.709538956736
Output for 5.3.7
5.04039085635
Output for 5.3.6
4.9109074496249
Output for 5.3.5
4.6445604703131
Output for 5.3.4
4.5077496846243
Output for 5.3.3
4.6934455065957
Output for 5.3.2
5.0493168598271
Output for 5.3.1
4.5812180075241
Output for 5.3.0
5.1194203976167
Output for 5.2.17
5.2989239670797
Output for 5.2.16
4.9504283293851
Output for 5.2.15
4.7306590886929
Output for 5.2.14
4.7772833103208
Output for 5.2.13
5.0612682286004
Output for 5.2.12
4.8894787111271
Output for 5.2.11
5.2618834007354
Output for 5.2.10
5.2873933055845
Output for 5.2.9
5.2751860976104
Output for 5.2.8
5.1782870756827
Output for 5.2.7
5.3835198322234
Output for 5.2.6
4.8671886608317
Output for 5.2.5
5.3038864919468
Output for 5.2.4
5.0764493975213
Output for 5.2.3
4.9353799633381
Output for 5.2.2
5.3290500921798
Output for 5.2.1
5.4496155059662
Output for 5.2.0
5.0088014164981
Output for 5.1.6
5.1451153180772
Output for 5.1.5
4.543945810778
Output for 5.1.4
4.7534904190123
Output for 5.1.3
4.9962300758326
Output for 5.1.2
5.0273008588829
Output for 5.1.1
4.7117659897598
Output for 5.1.0
4.6425437085063
Output for 5.0.5
4.6581507584351
Output for 5.0.4
4.7899265751661
Output for 5.0.3
5.2843525783552
Output for 5.0.2
4.5792224554248
Output for 5.0.1
5.0255074973803
Output for 5.0.0
5.4335865820449
Output for 4.4.9
5.2168909065504
Output for 4.4.8
5.2141716134335
Output for 4.4.7
4.5460310327104
Output for 4.4.6
4.5325036728906
Output for 4.4.5
4.9588878955501
Output for 4.4.4
5.4731239550622
Output for 4.4.3
5.4040736241285
Output for 4.4.2
5.4415143190145
Output for 4.4.1
4.8641407258642
Output for 4.4.0
4.6049182049953
Output for 4.3.11
4.5745612841912
Output for 4.3.10
5.0768289573383
Output for 4.3.9
4.7938803968923
Output for 4.3.8
4.7875544374285
Output for 4.3.7
4.7512685804401
Output for 4.3.6
5.3043262075187
Output for 4.3.5
4.7266407128082
Output for 4.3.4
4.8971276408514
Output for 4.3.3
5.2600782442652
Output for 4.3.2
4.6449423135002
Output for 4.3.1
5.0547838302119
Output for 4.3.0
5.3330577804395