in reply to Rand() with ?log10? distribution?

10**( log(1/(1-rand()))/log(2) ) - 1

[Update: You may want to shorten the range if you get too many small (0.x) values or values that are too large. Replace 1-rand() with, for example .9-.8*rand().]

10**( -log(1-rand())/log(2) ) - 1 # (same thing) (1-rand())**(log(.1)/log(2)) - 1 # (same thing)

- tye        

I'd show the (interesting) derivation, except the more words I include in a reply to you, the more likely the whole thing will turn ugly.

Replies are listed 'Best First'.
Re^2: Rand() with ?log10? distribution? (math)
by BrowserUk (Patriarch) on Jun 07, 2013 at 05:51 UTC

    Thanks.

    I didn't use this because: I couldn't work out how to set an upper limit; and the two-factor tuning is quite difficult, relative to the single factor tuning of primos solution.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.