Skip to content

Commit 306aba9

Browse files
committed
refactor: use logEachMap and array discrete-uniform for example
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 89ddee3 commit 306aba9

4 files changed

Lines changed: 14 additions & 22 deletions

File tree

lib/node_modules/@stdlib/number/float32/base/add/examples/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2021 The Stdlib Authors.
4+
* Copyright (c) 2026 The Stdlib Authors.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.

lib/node_modules/@stdlib/number/float32/base/div/examples/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2023 The Stdlib Authors.
4+
* Copyright (c) 2026 The Stdlib Authors.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2021 The Stdlib Authors.
4+
* Copyright (c) 2026 The Stdlib Authors.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
@@ -18,15 +18,11 @@
1818

1919
'use strict';
2020

21-
var rand = require( '@stdlib/random/base/discrete-uniform' );
21+
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
22+
var logEachMap = require( '@stdlib/console/log-each-map' );
2223
var mulf = require( './../lib' );
2324

24-
var x;
25-
var y;
26-
var i;
25+
var x = discreteUniform( 100, -50, 50 );
26+
var y = discreteUniform( 100, -50, 50 );
2727

28-
for ( i = 0; i < 100; i++ ) {
29-
x = rand( -50, 50 );
30-
y = rand( -50, 50 );
31-
console.log( '%d x %d = %d', x, y, mulf( x, y ) );
32-
}
28+
logEachMap( '%d x %d = %d', x, y, mulf );
Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2021 The Stdlib Authors.
4+
* Copyright (c) 2026 The Stdlib Authors.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
@@ -18,15 +18,11 @@
1818

1919
'use strict';
2020

21-
var rand = require( '@stdlib/random/base/discrete-uniform' );
21+
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
22+
var logEachMap = require( '@stdlib/console/log-each-map' );
2223
var subf = require( './../lib' );
2324

24-
var x;
25-
var y;
26-
var i;
25+
var x = discreteUniform( 100, -50, 50 );
26+
var y = discreteUniform( 100, -50, 50 );
2727

28-
for ( i = 0; i < 100; i++ ) {
29-
x = rand( -50, 50 );
30-
y = rand( -50, 50 );
31-
console.log( '%d - %d = %d', x, y, subf( x, y ) );
32-
}
28+
logEachMap( '%d - %d = %d', x, y, subf );

0 commit comments

Comments
 (0)