Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^6: Randomly choosing from a set of alternatives with varying popularity

by LanX (Saint)
on Mar 28, 2022 at 16:11 UTC ( [id://11142465]=note: print w/replies, xml ) Need Help??


in reply to Re^5: Randomly choosing from a set of alternatives with varying popularity
in thread Randomly choosing from a set of alternatives with varying popularity

> I'm curious why the order in which the hash is traversed would matter at all.

It doesn't for this special algorithm, like already explained here

But if you want the inverse - however "inversion" is defined - you need to build a new hash with accordingly "inverted" weights, like demonstrated here.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

  • Comment on Re^6: Randomly choosing from a set of alternatives with varying popularity

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (2)
As of 2024-04-24 17:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found