Re: [xquery-talk] [xsl] Re: Random number generation : requirements2014-05-08 04:17:54On 07/05/2014, Dimitre Novatchev dnovatchev(_at_)gmail(_dot_)com <xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote: On Tue, May 6, 2014 at 11:31 PM, Wolfgang Laun wolfgang(_dot_)laun(_at_)gmail(_dot_)com <xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:For instance: In Dimitre's example: values returned alternate between even and odd,Not true: From the 2002 article: 100 Randoms in (1, 10): 3, 10, 2, 9, 7, 2, 3, 10, 9, 4, 4, 3, 1, 5, 4, 10, 3, 6, 7, 1, 1, 10, 8, 3, 9, 3, 4, 1, 1, 5, 8, 6, 2, 5, 10, 1, 3, 8, 8, 10, 5, 1, 9, 10, 3, 10, 3, 2, 2, 8, 3, 8, 3, 8, 5, 2, 7, 6, 7, 2, 8, 1, 9, 8, 2, 4, 5, 2, 10, 8, 9, 9, 3, 10, 9, 6, 5, 8, 7, 3, 3, 3, 5, 3, 5, 9, 9, 10, 5, 2, 5, 1, 5, 1, 6, 8, 3, 6, 4, 1, But it *is* true. Any formula of the pattern rand*multiplier + increment exhibits this property: odd*odd + odd -> even even*odd + odd -> odd But: The higher the bits you take out of the basically generated random number (as you obtain them by dividing by some range) the more "random" they are. Also, there is absolutely no obstacle in using as many random generators (sequences) as needed -- one just needs a different seed for each of them. Please, read the article carefully. I didn't say anything about your implementation. I just wanted to state that the planned function should have this feature. - Please don't read anything I haven't written ;-) -W -- Cheers, Dimitre Novatchev --------------------------------------- Truly great madness cannot be achieved without significant intelligence. --------------------------------------- To invent, you need a good imagination and a pile of junk ------------------------------------- Never fight an inanimate object ------------------------------------- To avoid situations in which you might make mistakes may be the biggest mistake of all ------------------------------------ Quality means doing it right when no one is looking. ------------------------------------- You've achieved success in your field when you don't know whether what you're doing is work or play ------------------------------------- To achieve the impossible dream, try going to sleep. ------------------------------------- Facts do not cease to exist because they are ignored. ------------------------------------- Typing monkeys will write all Shakespeare's works in 200yrs.Will they write all patents, too? :) ------------------------------------- I finally figured out the only reason to be alive is to enjoy it. --~---------------------------------------------------------------- XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547 or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com --~--
|
|