How to use the @ethersproject/random.shuffled function in @ethersproject/random

To help you get started, we’ve selected a few @ethersproject/random examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ethers-io / ethers.js / packages / providers / fallback-provider.js View on Github external
FallbackProvider.prototype.perform = function (method, params) {
        var _this = this;
        var T0 = now();
        var runners = (random_1.shuffled(this.providers)).map(function (provider, i) {
            var weight = _this.weights[i];
            var rid = nextRid++;
            return {
                run: function () {
                    var t0 = now();
                    var start = t0 - T0;
                    _this.emit("debug", {
                        action: "request",
                        rid: rid,
                        backend: { weight: weight, start: start, provider: provider },
                        request: { method: method, params: properties_1.deepCopy(params) },
                        provider: _this
                    });
                    return FallbackProvider.doPerform(provider, method, params).then(function (result) {
                        var duration = now() - t0;
                        _this.emit("debug", {

@ethersproject/random

Random utility functions for ethers.

MIT
Latest version published 2 years ago

Package Health Score

65 / 100
Full package analysis