/[gzz]/gzz/gfx/demo/zipf.py
ViewVC logotype

Diff of /gzz/gfx/demo/zipf.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by jvk, Mon Sep 2 14:53:49 2002 UTC revision 1.2 by tjl, Fri Feb 21 16:47:57 2003 UTC
# Line 1  Line 1 
1    # (c) Janne Kujala
2    
3  def getZipfDistribution(n, theta = 0):  def getZipfDistribution(n, theta = 0):
4      probs = [ 1.0 / (i + 1.0)**(1.0 - theta) for i in range(0,n)]      probs = [ 1.0 / (i + 1.0)**(1.0 - theta) for i in range(0,n)]
5      C = 1.0 / reduce(lambda x,y: x+y, probs)      C = 1.0 / reduce(lambda x,y: x+y, probs)

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26