Click here to Skip to main content
15,902,635 members
Home / Discussions / C#
   

C#

 
AnswerRe: Modulo Function Pin
harold aptroot28-Aug-09 5:36
harold aptroot28-Aug-09 5:36 
AnswerRe: Modulo Function Pin
Dave Kreskowiak28-Aug-09 7:15
mveDave Kreskowiak28-Aug-09 7:15 
GeneralRe: Modulo Function Pin
Quake2Player28-Aug-09 7:22
Quake2Player28-Aug-09 7:22 
GeneralRe: Modulo Function Pin
Luc Pattyn28-Aug-09 7:38
sitebuilderLuc Pattyn28-Aug-09 7:38 
GeneralRe: Modulo Function Pin
DaveyM6928-Aug-09 7:38
professionalDaveyM6928-Aug-09 7:38 
GeneralRe: Modulo Function Pin
Quake2Player28-Aug-09 14:46
Quake2Player28-Aug-09 14:46 
GeneralRe: Modulo Function Pin
DaveyM6928-Aug-09 7:38
professionalDaveyM6928-Aug-09 7:38 
GeneralRe: Modulo Function [modified] Pin
Quake2Player29-Aug-09 11:55
Quake2Player29-Aug-09 11:55 
How can I use long if I'm generating random numbers???

This is all about the UNIVERSAL HASHING FUNCTION:

<code>
        public int Evaluate(int key) 
        {
                // Random prime bigger than 10000
                do {
                  randomPrime = rnd.Next(10001, 10000*999);
                }
                while (!IsPrime(randomPrime));

                this.randomA = rnd.Next(1, randomPrime - 1);
                this.randomB = rnd.Next(0, randomPrime - 1);

                return ((randomA * key + randomB) % randomPrime) % tableLength;
        }
</code>


Notes:
-10000 is the maximum possible key
-tableLength is 1000.
-randomA, randomB and randomPrime are ints

As Im getting negative numbers Im trying
return Math.Abs(((randomA * key + randomB) % randomPrime) % tableLength);

But its not giving me fast results in the hash table

modified on Saturday, August 29, 2009 6:01 PM

QuestionUsing Text Files Pin
gamer112728-Aug-09 4:54
gamer112728-Aug-09 4:54 
AnswerRe: Using Text Files Pin
Coding C#28-Aug-09 4:55
Coding C#28-Aug-09 4:55 
GeneralRe: Using Text Files Pin
gamer112728-Aug-09 5:13
gamer112728-Aug-09 5:13 
AnswerRe: Using Text Files Pin
OriginalGriff28-Aug-09 5:07
mveOriginalGriff28-Aug-09 5:07 
GeneralRe: Using Text Files Pin
gamer112728-Aug-09 5:19
gamer112728-Aug-09 5:19 
GeneralRe: Using Text Files Pin
OriginalGriff28-Aug-09 5:34
mveOriginalGriff28-Aug-09 5:34 
GeneralRe: Using Text Files Pin
Luc Pattyn28-Aug-09 7:40
sitebuilderLuc Pattyn28-Aug-09 7:40 
GeneralRe: Using Text Files Pin
OriginalGriff28-Aug-09 8:19
mveOriginalGriff28-Aug-09 8:19 
QuestionChange richtextbox colors - C# Pin
OrkanA28-Aug-09 4:39
OrkanA28-Aug-09 4:39 
AnswerRe: Change richtextbox colors - C# Pin
OrkanA29-Aug-09 4:57
OrkanA29-Aug-09 4:57 
QuestionDataBinding removal error Pin
kanchoette28-Aug-09 4:29
kanchoette28-Aug-09 4:29 
AnswerRe: DataBinding removal error Pin
Keith Barrow28-Aug-09 4:34
professionalKeith Barrow28-Aug-09 4:34 
GeneralRe: DataBinding removal error Pin
kanchoette30-Aug-09 4:21
kanchoette30-Aug-09 4:21 
QuestionI need to resize a large image of more than 2MEGABYTE and I can not upload it to the program Pin
gilvani28-Aug-09 3:54
gilvani28-Aug-09 3:54 
AnswerRe: I need to resize a large image of more than 2MEGABYTE and I can not upload it to the program Pin
Luc Pattyn28-Aug-09 4:07
sitebuilderLuc Pattyn28-Aug-09 4:07 
AnswerRe: I need to resize a large image of more than 2MEGABYTE and I can not upload it to the program Pin
OriginalGriff28-Aug-09 5:10
mveOriginalGriff28-Aug-09 5:10 
GeneralRe: I need to resize a large image of more than 2MEGABYTE and I can not upload it to the program Pin
gilvani28-Aug-09 7:02
gilvani28-Aug-09 7:02 

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.