<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
I don't know if this is pythonic or not, but try something like this:<br>
<br>
from math import log<br>
from random import randint<br>
def: skewedrandom(n):<br>
    int(log(randrange(1,n), 2))<br>
<br>
Play with your log to get the range you want<br>
<br>
Cheers,<br>
Cliff<br>
<br>
Grant Edwards wrote:
<blockquote cite="mid:13d6i72s8b2a3ad@corp.supernews.com" type="cite">
  <pre wrap="">On 2007-08-27, Jun-geun Park <a class="moz-txt-link-rfc2396E" href="mailto:junkeun.park@gmail.com"><junkeun.park@gmail.com></a> wrote:

  </pre>
  <blockquote type="cite">
    <blockquote type="cite">
      <pre wrap="">I have a list of items, and need to choose several elements
from it, "almost random". The catch is that the elements from
the beginning should have more chance of being selected than
those at the end (how much more? I don't care how the
"envelope" of probability looks like at this point - can be
linear). I see that there are several functions in Python
standard libraries for various distribution, but is there an
easy pythonic way to make them do what I need?
      </pre>
    </blockquote>
  </blockquote>
  <pre wrap=""><!---->
  </pre>
  <blockquote type="cite">
    <pre wrap="">That's weird. random.randint(a,b) will be enough for most
cases. Test your system to see the distribution is uniform
with something like:
    </pre>
  </blockquote>
  <pre wrap=""><!---->
Except he wants a non-uniform distribution.

  </pre>
</blockquote>
<br>
</body>
</html>