Site Map: Structured Outline

Hop to Top of Documentation Tree
Leap to Chapter-Start
Move Up a Page


RANDOM-PICKING PROCEDURE


The cost probability curve may be a nice smooth one, or a collection of rectangles or other shapes.

It can always be converted to a histogram.

Add the count from every histogram channel, and mark the start point and end-point for each channel on the accumulating count.

Use the pseudo-random number generator (available with most programming languages) to pick a value from the accumulating count.

Chech through the various start-point/end-point which channel was selected, and use its value.

Illustration:

The cost histogram looks like:





cost histogram

Number from: to: count
1 $0 $20,000 8
2 $20,001 $35,000 22
3 $35,001 $57,000 11
4 $57,001 $83,000 4

The accumulating count:

8+22+11+4 = 45


Channel 1: start =1 end = 8
Channel 2: start =9 end =30
Channel 3: start =31 end =41
Channel 4: start =42 end =45

The PRNG picking a number from 1 to 45, will pick, say 28. This falls into channel 2, and the corresponding value is $20,000 to $35,000




Comment? eMail: teach_me@classexpress.com








(c) Class Express LLC Contact Us