[Haskell-cafe] How to select n random words from a file ...

Aditya Manthramurthy aditya.mmy at gmail.com
Mon Jun 11 11:15:09 CEST 2012


Pick the i-th word (replacing the previously chosen word, if any) with
probability 1/i? (numbering of words starts from 1 instead of 0).

On 11 June 2012 11:13, KC <kc1956 at gmail.com> wrote:

> An interesting related problem is if you are only allowed one pass through
> the data how would you randomly choose one word.
>
>
>
>
>
> --
> --
> Regards,
> KC
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120611/15f7e39a/attachment.htm>


More information about the Haskell-Cafe mailing list