Skip to content

Commit ceb3123

Browse files
committed
refactor examples
1 parent d5ca7f3 commit ceb3123

File tree

1 file changed

+6
-14
lines changed
  • lib/node_modules/@stdlib/blas/base/dswap/examples

1 file changed

+6
-14
lines changed

lib/node_modules/@stdlib/blas/base/dswap/examples/index.js

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2020 The Stdlib Authors.
4+
* Copyright (c) 2023 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,22 +18,14 @@
1818

1919
'use strict';
2020

21-
var randu = require( '@stdlib/random/base/randu' );
22-
var round = require( '@stdlib/math/base/special/round' );
23-
var Float64Array = require( '@stdlib/array/float64' );
21+
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory;
22+
var filledarrayBy = require( '@stdlib/array/filled-by' );
2423
var dswap = require( './../lib' );
2524

26-
var x;
27-
var y;
28-
var i;
29-
30-
x = new Float64Array( 10 );
31-
y = new Float64Array( 10 );
32-
for ( i = 0; i < x.length; i++ ) {
33-
x[ i ] = round( randu()*500.0 );
34-
y[ i ] = round( randu()*255.0 );
35-
}
25+
var x = filledarrayBy( 10, 'float64', discreteUniform( 0, 500 ) );
3626
console.log( x );
27+
28+
var y = filledarrayBy( x.length, 'float64', discreteUniform( 0, 255 ) );
3729
console.log( y );
3830

3931
// Swap elements in `x` and `y` starting from the end of `y`:

0 commit comments

Comments
 (0)