Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Weighted Pick - Array Extension
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
taelor  
View profile  
 More options Feb 12 2009, 11:18 am
From: taelor <thred...@gmail.com>
Date: Thu, 12 Feb 2009 08:18:09 -0800 (PST)
Local: Thurs, Feb 12 2009 11:18 am
Subject: Weighted Pick - Array Extension
Gents,

Tell me what you think about this extension to the array class for
faker.

I have been having to come up with alot of fake data, and I wanted to
randomly pick from an array, but pick certain things more than others.
So came up with the idea of a weighted_pick from an array.

http://pastie.org/387157

basically, the idea is to give the first index in the array the
highest chance of getting picked, and the last place getting the
lowest. the first index gets (roughly) a 50% chance, the second gets a
25%, the third a 12.5% and so on.

I also have been working on a Faker::Financial addition, but its not
quite ready to post yet.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »