Re: split the load?

トップ ページ
このメッセージを削除
このメッセージに返信
著者: Neal Becker
日付:  
To: Robert Black
CC: exim-users
題目: Re: split the load?
>>>>> "Robert" == Robert Black <r.black@???> writes:

    >> At the relevant time, Exim is scanning the list of RRs returned by the
    >> nameserver, and inserting them into a list in order of their MX values.
    >> The current rule is "insert before the entry with a higher MX value".
    >> It would have to be changed by the addition of an extra rule such as
    >> "If there are a group of entries with the same MX value, choose at
    >> random where to insert." If there are n such entries, then there are n+1
    >> possible places to insert. What is the best *cheap* way of getting a
    >> random number between 0 and n? Is something like "take the last m bits
    >> of the time of day modulo (n+1)" good enough for this purpose?


I would just generate a random integer (using random(), for example),
then if there are n slots just do:

int i = random() % n;

Why make this complicated?