From 9bff56481822d26740ab8562b5cac6209e6fd31f Mon Sep 17 00:00:00 2001 From: Daniel Chege Date: Mon, 23 Feb 2026 17:49:53 +0300 Subject: [PATCH] chore: address commit comments for commit 8b01d81 --- lib/node_modules/@stdlib/utils/tabulate-by/README.md | 12 +++--------- .../@stdlib/utils/tabulate-by/examples/index.js | 12 +++--------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/lib/node_modules/@stdlib/utils/tabulate-by/README.md b/lib/node_modules/@stdlib/utils/tabulate-by/README.md index 493939436df5..4d3e84270e68 100644 --- a/lib/node_modules/@stdlib/utils/tabulate-by/README.md +++ b/lib/node_modules/@stdlib/utils/tabulate-by/README.md @@ -127,15 +127,13 @@ The returned frequency table is an `array` of `arrays`. Each sub-array correspon ```javascript -var randu = require( '@stdlib/random/base/randu' ); -var floor = require( '@stdlib/math/base/special/floor' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var take = require( '@stdlib/array/take' ); var tabulateBy = require( '@stdlib/utils/tabulate-by' ); var vals; var arr; var out; -var i; -var j; function indicator( value ) { return value[ 0 ]; @@ -144,11 +142,7 @@ function indicator( value ) { vals = [ 'beep', 'boop', 'foo', 'bar', 'woot', 'woot' ]; // Generate a random collection... -arr = []; -for ( i = 0; i < 100; i++ ) { - j = floor( randu()*vals.length ); - arr.push( vals[ j ] ); -} +arr = take( vals, discreteUniform( 100, 0, vals.length - 1 ) ); // Generate a frequency table: out = tabulateBy( arr, indicator ); diff --git a/lib/node_modules/@stdlib/utils/tabulate-by/examples/index.js b/lib/node_modules/@stdlib/utils/tabulate-by/examples/index.js index 05eb907e5f70..70d2eb28c996 100644 --- a/lib/node_modules/@stdlib/utils/tabulate-by/examples/index.js +++ b/lib/node_modules/@stdlib/utils/tabulate-by/examples/index.js @@ -18,15 +18,13 @@ 'use strict'; -var randu = require( '@stdlib/random/base/randu' ); -var floor = require( '@stdlib/math/base/special/floor' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var take = require( '@stdlib/array/take' ); var tabulateBy = require( './../lib' ); var vals; var arr; var out; -var i; -var j; function indicator( value ) { return value[ 0 ]; @@ -35,11 +33,7 @@ function indicator( value ) { vals = [ 'beep', 'boop', 'foo', 'bar', 'woot', 'woot' ]; // Generate a random collection... -arr = []; -for ( i = 0; i < 100; i++ ) { - j = floor( randu()*vals.length ); - arr.push( vals[ j ] ); -} +arr = take( vals, discreteUniform( 100, 0, vals.length - 1 ) ); // Generate a frequency table: out = tabulateBy( arr, indicator );