Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: Algorithm Help

by Anonymous Monk
on Jan 18, 2010 at 18:35 UTC ( #818016=note: print w/ replies, xml ) Need Help??

in reply to Algorithm Help

Wouldn't it be easy to just randomly choose a prefix from a cache ?
Putting the probabilities aside, it's easy to deterministically generate all possible prefixes, and to classify them into weight categories.
With all prefixes separated by weight it's also easy to randomly choose one, given a weight.

Comment on Re: Algorithm Help
Replies are listed 'Best First'.
Re^2: Algorithm Help
by dreadpiratepeter (Priest) on Jan 18, 2010 at 18:54 UTC

    Yes, but the issue is that I will pass in a weight range for an object, not a prefix. the total of prefix, all prefix2, plus and suffix is the weight of the object. and that needs to be in the given range

    "Worry is like a rocking chair. It gives you something to do, but it doesn't get you anywhere."
      sorry, now reading my reply again made me realize I used 'prefix' to describe 2 different things.
      I meant generate all possible combinations, classify those combinations by weight and, given a weight range, randomly choose from this 'combination pool'

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2015-12-01 04:41 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (794 votes), past polls