Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Bag uniform distribution algorithms

by BrowserUk (Pope)
on Apr 25, 2013 at 16:45 UTC ( #1030697=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #! perl -slw
    use strict;
    ...
    
    pp gen( { A => 4, B => 2, C => 3, D => 1 } );
    pp gen( { A => 5, B => 4, C => 3, D => 2, E => 1 } );
    
  2. or download this
    C:\test>1030688.pl
    ["A", "C", "B", "A", "D", "C", "B", "A", "C", "A"]
    ["A", "B", "C", "A", "D", "B", "C", "E", "A", "B", "D", "C", "A", "B",
    + "A"]
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1030697]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2016-07-26 05:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What is your favorite alternate name for a (specific) keyboard key?


















    Results (232 votes). Check out past polls.