File tree Expand file tree Collapse file tree 1 file changed +6
-14
lines changed
lib/node_modules/@stdlib/blas/base/dswap/examples Expand file tree Collapse file tree 1 file changed +6
-14
lines changed Original file line number Diff line number Diff line change 1
1
/**
2
2
* @license Apache-2.0
3
3
*
4
- * Copyright (c) 2020 The Stdlib Authors.
4
+ * Copyright (c) 2023 The Stdlib Authors.
5
5
*
6
6
* Licensed under the Apache License, Version 2.0 (the "License");
7
7
* you may not use this file except in compliance with the License.
18
18
19
19
'use strict' ;
20
20
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' ) ;
24
23
var dswap = require ( './../lib' ) ;
25
24
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 ) ) ;
36
26
console . log ( x ) ;
27
+
28
+ var y = filledarrayBy ( x . length , 'float64' , discreteUniform ( 0 , 255 ) ) ;
37
29
console . log ( y ) ;
38
30
39
31
// Swap elements in `x` and `y` starting from the end of `y`:
You can’t perform that action at this time.
0 commit comments