Skip to content
23 changes: 9 additions & 14 deletions lib/node_modules/@stdlib/utils/unzip/examples/index.js
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@agananya03 Mind updating the corresponding example in the README with the current changes?

Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,17 @@

'use strict';

var round = require( '@stdlib/math/base/special/round' );
var randu = require( '@stdlib/random/base/randu' );
var pow = require( '@stdlib/math/base/special/pow' );
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' );
var filled2dBy = require( '@stdlib/array/base/filled2d-by' );
var unzip = require( './../lib' );

var arr = new Array( 100 );
var len = 5;

var i;
var j;
for ( i = 0; i < arr.length; i++ ) {
arr[ i ] = new Array( len );
for ( j = 0; j < len; j++ ) {
arr[ i ][ j ] = round( randu() * pow(10, j) );
}
function random( indices ) {
var j = indices[ 1 ] * 100;
return discreteUniform( j, j+100 );
}
var out = unzip( arr );

var arr = filled2dBy( [ 100, 5 ], random );
console.dir( arr );

var out = unzip( arr );
console.dir( out );