Click here to Skip to main content
15,893,814 members
Home / Discussions / Algorithms
   

Algorithms

 
AnswerRe: Search algorithm Pin
joon vh.19-Mar-07 3:36
joon vh.19-Mar-07 3:36 
QuestionPlease tell me about dithering. How can I change color depth of bmp 24 bits to bmp 4 bits? Pin
FlytotheBluesky14-Mar-07 18:13
FlytotheBluesky14-Mar-07 18:13 
AnswerRe: Please tell me about dithering. How can I change color depth of bmp 24 bits to bmp 4 bits? Pin
RabidHamster17-Mar-07 18:52
RabidHamster17-Mar-07 18:52 
AnswerRe: Please tell me about dithering. How can I change color depth of bmp 24 bits to bmp 4 bits? Pin
Rilhas19-May-07 10:11
Rilhas19-May-07 10:11 
QuestionWeighted Decision Pin
Mark J. Miller14-Mar-07 8:56
Mark J. Miller14-Mar-07 8:56 
AnswerRe: Weighted Decision Pin
Dan Neely14-Mar-07 9:55
Dan Neely14-Mar-07 9:55 
GeneralRe: Weighted Decision Pin
Mark J. Miller14-Mar-07 9:59
Mark J. Miller14-Mar-07 9:59 
GeneralRe: Weighted Decision Pin
Mark J. Miller14-Mar-07 10:18
Mark J. Miller14-Mar-07 10:18 
Thanks,

Simply chosing the opposite worked:

<br />
    class Class3<br />
    {<br />
        static void Main(string[] args)<br />
        {<br />
            Random rand = new Random();<br />
<br />
            int cnt1 = 0, cnt2 = 0;<br />
            double val1 = 20.223, val2 = 37.882;<br />
            int tot = Convert.ToInt32(val1 + val2);<br />
<br />
            for (int i = 0; i < 10000; i++)<br />
            {<br />
                if (rand.Next(tot) > val1)<br />
                    cnt1++;<br />
                else<br />
                    cnt2++;<br />
            }<br />
<br />
            Console.WriteLine("Total: " + tot);<br />
            Console.WriteLine("Val1 ({0}): {1}", val1, cnt1);<br />
            Console.WriteLine("Val2 ({0}): {1}", val2, cnt2);<br />
        }<br />
    }<br />


The output is consitent no matter which values I choose, the lower value is chosen more than the higher value by a ratio that matches the ratio which matches the values themselves. I'm going to try this next with my AVL tree and watch those results. After this testing I think already I have the answer to my next problem and that was going to be with selecting a random value at each node. But I figure I can get the random value once at the top and use the same result all the way down the tree. I'll try it each way and see which method has better distribution.

Thanks again,

Mark
QuestionPi Day Pin
ricecake14-Mar-07 3:32
ricecake14-Mar-07 3:32 
AnswerRe: Pi Day Pin
Shog914-Mar-07 5:03
sitebuilderShog914-Mar-07 5:03 
GeneralRe: Pi Day Pin
ricecake14-Mar-07 5:08
ricecake14-Mar-07 5:08 
AnswerRe: Pi Day Pin
Dan Neely14-Mar-07 5:15
Dan Neely14-Mar-07 5:15 
QuestionMatlab help Pin
ashee rai11-Mar-07 14:40
ashee rai11-Mar-07 14:40 
QuestionWMP Visualization help Pin
XTAL2569-Mar-07 23:34
XTAL2569-Mar-07 23:34 
AnswerRe: WMP Visualization help Pin
Luc Pattyn9-Mar-07 23:41
sitebuilderLuc Pattyn9-Mar-07 23:41 
GeneralRe: WMP Visualization help Pin
XTAL25610-Mar-07 0:33
XTAL25610-Mar-07 0:33 
GeneralRe: WMP Visualization help Pin
Luc Pattyn10-Mar-07 13:25
sitebuilderLuc Pattyn10-Mar-07 13:25 
GeneralRe: WMP Visualization help Pin
XTAL25610-Mar-07 22:25
XTAL25610-Mar-07 22:25 
GeneralRe: WMP Visualization help Pin
Luc Pattyn10-Mar-07 23:08
sitebuilderLuc Pattyn10-Mar-07 23:08 
GeneralRe: WMP Visualization help Pin
XTAL25611-Mar-07 16:27
XTAL25611-Mar-07 16:27 
GeneralRe: WMP Visualization help Pin
Luc Pattyn12-Mar-07 10:22
sitebuilderLuc Pattyn12-Mar-07 10:22 
GeneralRe: WMP Visualization help Pin
XTAL25612-Mar-07 21:41
XTAL25612-Mar-07 21:41 
QuestionProcessing video frames Pin
Techbear19809-Mar-07 18:42
Techbear19809-Mar-07 18:42 
AnswerRe: Processing video frames Pin
Jarno Burger14-Mar-07 0:05
Jarno Burger14-Mar-07 0:05 
AnswerRe: Processing video frames Pin
Rilhas19-May-07 10:28
Rilhas19-May-07 10:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.