Re: Testing a class which utilizes randomness
Mark Levison <[email protected]> Fri, 4 Apr 2014 14:39:11 -0400
| Newsgroups | gmane.comp.programming.test-driven-development |
|---|---|
| Message-ID | <CA+UdPQ84DAPiXsoR5iLY36-LMTyOyLkYEppgNe65VnJxFkxorg@mail.gmail.com> |
All you've done is test with you've approximately built a random number generator. My underlying point was the OP might want to choose a slightly saner problem. Cheers Mark On Fri, Apr 4, 2014 at 1:55 PM, Jarod Eells <[email protected]> wrote: > > > On Fri, Apr 04, 2014 at 12:23:49PM -0400, Mark Levison wrote: > > Desirable? - by definition - randomness can and should occasionally > > duplicate something. Testing a random number generator is very hard. > > > > Cheers > > Mark > > Testing a RNG doesn't have to be hard. > Just have to roll the dice a sufficient number of times and bin out the > results. > Then check that the bins are filled according to the expected statistical > distribution. > If you want a higher accuracy for your test then make more bins and/or > roll more numbers. > > Jarod Eells > > > -- [image: headshot-square-300x300]<http://www.flickr.com/photos/36331075@N00/9674877046/> *Mark Levison* | 1 (877) 248-8277 | Twitter <https://twitter.com/mlevison> | LinkedIn <http://ca.linkedin.com/in/marklevison> | Facebook<https://www.facebook.com/agilepainrelief> Certified ScrumMaster Training: Vancouver<http://agilepainrelief.com/courses/vancouver> | Edmonton <http://agilepainrelief.com/courses/edmonton> | Ottawa<http://agilepainrelief.com/courses/ottawa> | Montreal <http://agilepainrelief.com/courses/montreal> | Toronto<http://agilepainrelief.com/courses/toronto> Agile Pain Relief Consulting <http://agilepainrelief.com/> | Notes from a Tool User <http://agilepainrelief.com/notesfromatooluser> Proud Sponsor of Agile Tour Gatineau Ottawa <http://goagiletour.ca/> and Agile Coach Camp Canada <http://agilecoachcampcanada.wordpress.com/>