mIRC Home    About    Download    Register    News    Help

Print Thread
#249831 18/12/14 09:08 PM
Joined: Jun 2014
Posts: 248
B
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Jun 2014
Posts: 248
I've recently been trying to incorporate hash tables into my life. The joy and love of hash tables has added new depth to my everyday. I feel like I would be filled with more love if I was clear on the proper way to declare the number of buckets.

I have looked at the equation that says what is ideal. So I thought I'd just use that when I made the hashtable. But when I hmake table %number it always returns the invalid parameter. While I'm sure if I did hmake table 500 it would work just fine, it seems like I can't always know what size my hashtables will end up being so I'd like to use the equation and calculate what size hash table would be right when I make the hash table, but that doesn't seem to work for me. Am I doing something wrong?

Belhifet #249833 18/12/14 09:49 PM
Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
Which equation, and well what's the value of %number?


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Wims #249834 18/12/14 11:06 PM
Joined: Jun 2014
Posts: 248
B
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Jun 2014
Posts: 248
buckets = total keys / .78

so I set number like

var %number $calc($ini(filename.ini,0) / 0.78)

hmake table %number

and It doesn't return love, only hate. Or rather it just says invalid parameter.

Belhifet #249835 18/12/14 11:32 PM
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
You need to use a whole number.

Loki12583 #249836 18/12/14 11:42 PM
Joined: Jun 2014
Posts: 248
B
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Jun 2014
Posts: 248
Ohhhhhhhhhhhhhhhhhhhhh.

Derp..Is setting the buckets parameter dynamically a a good choice?


Is floor the right command to use in this case?
var %number $floor($calc($ini(filename.ini,0) / 0.78))

Last edited by Belhifet; 18/12/14 11:43 PM.
Belhifet #249867 20/12/14 04:24 PM
Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
$floor or $int, doesn't matter much, if your number of bucket is even, mIRC automatically adds '1', the range of the bucket is 1-10001


#mircscripting @ irc.swiftirc.net == the best mIRC help channel

Link Copied to Clipboard