<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"><head><!--[if gte mso 9]><xml><o:OfficeDocumentSettings><o:AllowPNG/><o:PixelsPerInch>96</o:PixelsPerInch></o:OfficeDocumentSettings></xml><![endif]--></head><body><div style="color:#000; background-color:#fff; font-family:Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div id="yui_3_16_0_ym19_1_1498468339092_13988" dir="ltr"><span id="yui_3_16_0_ym19_1_1498468339092_13995">This post is a useful discussion on randomness . <a href="http://www.kovach.me/posts/2017-01-30-haskell-bits-randomness.html" class="enhancr2_0f5012da-26df-2ac1-22e7-824eaebbfa4a" id="yui_3_16_0_ym19_1_1498468339092_14000">Abstract Nonsense</a><br></span></div><div dir="ltr" id="yui_3_16_0_ym19_1_1498468339092_14007"><span id="yui_3_16_0_ym19_1_1498468339092_13995"></span></div><div id="yui_3_16_0_ym19_1_1498468339092_14042"><br></div><div id="enhancr2_0f5012da-26df-2ac1-22e7-824eaebbfa4a" class="yahoo-link-enhancr-card yahoo-link-enhancr-not-allow-cover ymail-preserve-class ymail-preserve-style" style="max-width:400px;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;" data-url="http://www.kovach.me/posts/2017-01-30-haskell-bits-randomness.html" data-type="yenhancr" data-category="article" data-embed-url="" data-size="medium" dir="ltr" contenteditable="false"> <a href="http://www.kovach.me/posts/2017-01-30-haskell-bits-randomness.html" style="text-decoration:none !important; color: #000 !important" class="yahoo-enhancr-cardlink" target="_blank" rel="noreferrer" id="yui_3_16_0_ym19_1_1498468339092_14146"> <table class="card-wrapper" style="max-width:400px;" id="yui_3_16_0_ym19_1_1498468339092_14145" cellspacing="0" cellpadding="0" border="0"> <tbody id="yui_3_16_0_ym19_1_1498468339092_14144"><tr id="yui_3_16_0_ym19_1_1498468339092_14143"> <td id="yui_3_16_0_ym19_1_1498468339092_14142" width="400"> <table class="card-info" style="background:#fff;max-width:400px;border:1px solid #e0e4e9;border-bottom:3px solid #000000;" id="yui_3_16_0_ym19_1_1498468339092_14141" width="100%" cellspacing="0" cellpadding="0" border="0"> <tbody id="yui_3_16_0_ym19_1_1498468339092_14140"><tr id="yui_3_16_0_ym19_1_1498468339092_14139"> <td style="vertical-align:top;padding:16px 0 16px 12px;"> </td> <td style="vertical-align:middle;padding:16px 12px;width:99%;" id="yui_3_16_0_ym19_1_1498468339092_14138"> <h2 class="card-title" style="margin:0 0 4px 0;font-size:16px;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;word-break:break-word;">Abstract Nonsense</h2> <div class="card-description" style="font-size:11px;line-height:15px;color:#999;word-break:break-word;"></div> </td> <td class="card-share-container"></td> </tr> </tbody></table> </td> </tr> </tbody></table> </a></div><div id="yui_3_16_0_ym19_1_1498468339092_14136"><br></div> <div class="qtdSeparateBR"><br><br></div><div class="yahoo_quoted" style="display: block;"> <div style="font-family: Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, Sans-Serif; font-size: 16px;"> <div dir="ltr"><font size="2" face="Arial"> On Friday, 23 June 2017, 16:11, David McBride <toad3k@gmail.com> wrote:<br></font></div> <br><br> <div class="y_msg_container"><div dir="ltr">When you are unsure about the differences between functions, it can be<br clear="none">good to read the haddocks for the library.<br clear="none"><br clear="none"><a shape="rect" href="http://hackage.haskell.org/package/random-1.1/docs/System-Random.html" target="_blank">http://hackage.haskell.org/package/random-1.1/docs/System-Random.html</a><br clear="none"><br clear="none">The standard haskell random library supports the idea of splitting a<br clear="none">seed randomly. You take one seed and split it, and now you have two<br clear="none">seeds, which will each generate different randoms independently.<br clear="none">getStdGen gets the current global seed. newStdGen splits new a seed<br clear="none">off of the current global seed. mkStdGen allows you to create a seed<br clear="none">from a value so that you can get the same set of randoms repeatedly.<br clear="none"><br clear="none">I would say if you are in IO, just use randomRIO. If you are in<br clear="none">monadic code that not IO at its base, you should use MonadRandom<br clear="none">library on hackage. Quickcheck randomness is only really used in<br clear="none">quickcheck, although it is probably based off the standard libraries.<br clear="none"><br clear="none">Just keep in mind that randomness is a concept that is a little hard<br clear="none">to wrap your head around in haskell until you've been using it a<br clear="none">little while.<br clear="none"><br clear="none">On Fri, Jun 23, 2017 at 10:24 AM, Silent Leaf <<a shape="rect" ymailto="mailto:silent.leaf0@gmail.com" href="mailto:silent.leaf0@gmail.com">silent.leaf0@gmail.com</a>> wrote:<br clear="none">> Hi,<br clear="none">> I've had trouble finding the best way(s) to use random values in haskell, as<br clear="none">> it seems like there are several modules that either do the same thing or<br clear="none">> reuse one another i'm not sure.<br clear="none">><br clear="none">> There is System.Random<br clear="none">> - is it better to use the streams random(R)s or a more imperative randomRIO?<br clear="none">> - is it better to use mkStdGen or newStdGen or getStdGen?<br clear="none">> There is Test.QuickCheck and its type(class?) Gen<br clear="none">> There is a module in Control.Monad (i think) which exports the type Rnd<br clear="none">><br clear="none">> What about performances, and all those options? What do you like to use with<br clear="none">> random numbers?<br clear="none">><br clear="none">> I know that's a lot of questions. feel free to only answer to a few of them.<br clear="none">> :)<br clear="none">><br clear="none">> _______________________________________________<br clear="none">> Beginners mailing list<br clear="none">> <a shape="rect" ymailto="mailto:Beginners@haskell.org" href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br clear="none">> <a shape="rect" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><div class="yqt3837731776" id="yqtfd48212"><br clear="none">><br clear="none">_______________________________________________<br clear="none">Beginners mailing list<br clear="none"><a shape="rect" ymailto="mailto:Beginners@haskell.org" href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br clear="none"><a shape="rect" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br clear="none"></div></div><br><br></div> </div> </div> </div></div></body></html>