On Wed, 2010-06-02 at 16:11 +0200, Henning Thielemann wrote: > Sorry, I missed this post. > > > Maciej Piechotka schrieb: > > > Well - i tried to write some package dealing with distributions etc. > > > > If you have something like that: > > > > instance ... => Distribution (Linear a) a where > > rand (Linear f s) g = > > let (gf, gt) = genRange g > > (v, g') = next g > > in (g', f + (fromIntegral v * s) / fromIntegral (gt - gf)) > > > > (I haven't check it but IMHO it is right implementation) > > > > Now I have following options: > > > > - Implement per Int/Int8/... > > - Implement IntegerLinear and FractionalLinear separatly > > That is, what you need is a general division with rounding. But you > might more generally want a custom type class with a method that selects > an element from a set for given parameters gf, gt, v. This way, you > could also handle distributions on Enumeration types. You certainly you > do not want, say a division operation on Monday, Tuesday, ..., Sunday, > but having a probability distribution of weekdays is very reasonable. > > Btw. you may want to have a look at: > http://hackage.haskell.org/package/probability
Hmm. Thanks - however I fail to figure out how to do something like: "generate a random number with normal distribution with average avg and standard deviation stdev". Regards
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe