lib/rpc-client/router.js
function rdRoute(client, serverType, msg, cb) {
    const servers = client._station.serversMap[serverType];
    if (!servers || !servers.length) {
        utils.invokeCallback(cb, new Error(`rpc servers not exist with serverType: ${serverType}`));
        return;
    }
    const index = Math.floor(Math.random() * servers.length);
    utils.invokeCallback(cb, null, servers[index]);
}
function rdRoute(client, serverType, msg, cb) {
    const servers = client._station.serversMap[serverType];
    if (!servers || !servers.length) {
        utils.invokeCallback(cb, new Error(`rpc servers not exist with serverType: ${serverType}`));
        return;
    }
    const index = Math.floor(Math.random() * servers.length);
    utils.invokeCallback(cb, null, servers[index]);
}
function rdRoute ( client , serverType , msg , cb ) { const servers = client . _station . serversMap [ serverType ] ; if ( ! servers || ! servers . length ) { utils . invokeCallback ( cb , new Error ( ` ${ serverType } ` ) ) ; return ; } const index = Math . floor ( Math . random ( ) * servers . length ) ; utils . invokeCallback ( cb , null , servers [ index ] ) ; }
Random algorithm for calculating server id.

@param client {Object} rpc client.
@param serverType {String} rpc target serverType.
@param msg {Object} rpc message.
@param cb {Function} cb(err, serverId).
Random algorithm for calculating server id .