Skip to content

Commit ac822c4

Browse files
upgrade random and functools
1 parent 30754e3 commit ac822c4

File tree

6 files changed

+15
-32
lines changed

6 files changed

+15
-32
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
"devDependencies": {
99
"aureooms-node-package": "^2.0.3",
1010
"aureooms-js-itertools": "^0.2.0",
11-
"aureooms-js-functools": "^1.0.0",
11+
"aureooms-js-functools": "^2.0.3",
1212
"aureooms-js-compare": "^1.4.1",
13-
"aureooms-js-random": "^0.0.4",
13+
"aureooms-js-random": "^1.0.1",
1414
"aureooms-js-search": "^0.0.3",
1515
"aureooms-js-array": "^2.0.2"
1616
},
@@ -36,4 +36,4 @@
3636
"type": "git"
3737
},
3838
"version": "5.0.3"
39-
}
39+
}

test/js/src/inplacesort.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,14 @@ var check = function ( sortname, method, ctor, n, comparename, compare ) {
1818

1919
test( title, function () {
2020

21-
var randint, sample, shuffle, a;
22-
23-
// SETUP RANDOM
24-
randint = random.randint;
25-
sample = random.__sample__( randint );
26-
shuffle = random.__shuffle__( sample );
21+
var a ;
2722

2823
// SETUP ARRAY
2924
a = new ctor(n);
3025
array.iota( a, 0, n, 0 );
3126

3227
// SORT ARRAY
33-
shuffle( a, 0, n );
28+
random.shuffle( a, 0, n );
3429
method( compare, a, 0, n );
3530

3631
// TEST PREDICATE

test/js/src/mergesort.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var all, util, array, random, compare, functools, itertools, shuffle;
1+
var all, util, array, random, compare, functools, itertools ;
22

33
util = require( "util" );
44
array = require( "aureooms-js-array" );
@@ -7,8 +7,6 @@ compare = require( "aureooms-js-compare" );
77
functools = require( "aureooms-js-functools" );
88
itertools = require( "aureooms-js-itertools" );
99

10-
shuffle = random.__shuffle__( random.__sample__( random.randint ) );
11-
1210
all = function( comparename, compare, mergesortname, mergesort, n, type ) {
1311

1412
var title;
@@ -27,7 +25,7 @@ all = function( comparename, compare, mergesortname, mergesort, n, type ) {
2725
array.iota( a, 0, n, 0 );
2826

2927
// SORT ARRAY
30-
shuffle( a, 0, n );
28+
random.shuffle( a, 0, n );
3129
mergesort( compare, a, 0, n, d, 0, n );
3230

3331
deepEqual( sort.issorted( compare , d , 0 , n ) , n , "check sorted" );

test/js/src/multiselect.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var all, util, array, search, random, compare, functools, itertools, sample, shuffle;
1+
var all, util, array, search, random, compare, functools, itertools ;
22

33
util = require( "util" );
44
array = require( "aureooms-js-array" );
@@ -8,9 +8,6 @@ compare = require( "aureooms-js-compare" );
88
functools = require( "aureooms-js-functools" );
99
itertools = require( "aureooms-js-itertools" );
1010

11-
sample = random.__sample__( random.randint );
12-
shuffle = random.__shuffle__( sample );
13-
1411
all = function ( partitionname, partition, comparename, comparator, n, type ) {
1512

1613
var title;
@@ -30,7 +27,7 @@ all = function ( partitionname, partition, comparename, comparator, n, type ) {
3027
// SETUP REF ARRAY
3128
ref = new type( n );
3229
array.iota( ref, 0, n, 0 );
33-
shuffle( ref, 0, n );
30+
random.shuffle( ref, 0, n );
3431
array.sort( comparator, ref );
3532

3633
// SETUP TEST ARRAY
@@ -41,12 +38,12 @@ all = function ( partitionname, partition, comparename, comparator, n, type ) {
4138
i = a.length;
4239

4340
len = random.randint( 0, i + 1 );
44-
sample( len, a, 0, n );
41+
random.sample( len, a, 0, n );
4542
k = new type( len );
4643
array.copy( a, 0, len, k, 0 );
4744
array.sort( compare.increasing, k );
4845

49-
shuffle( a, 0, n );
46+
random.shuffle( a, 0, n );
5047
multiselect( comparator, a, 0, n, k, 0, len );
5148

5249
while ( len-- ) {

test/js/src/quickselect.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var all, util, array, random, compare, functools, itertools, shuffle;
1+
var all, util, array, random, compare, functools, itertools;
22

33
util = require( "util" );
44
array = require( "aureooms-js-array" );
@@ -7,8 +7,6 @@ compare = require( "aureooms-js-compare" );
77
functools = require( "aureooms-js-functools" );
88
itertools = require( "aureooms-js-itertools" );
99

10-
shuffle = random.__shuffle__( random.__sample__( random.randint ) );
11-
1210
all = function ( quickselectname, quickselect, comparename, compare, n, type ) {
1311

1412
var title;
@@ -33,7 +31,7 @@ all = function ( quickselectname, quickselect, comparename, compare, n, type ) {
3331
// TEST ALL INDEX SELECTION
3432
i = a.length;
3533
while ( i-- ) {
36-
shuffle( a, 0, n );
34+
random.shuffle( a, 0, n );
3735
quickselect( compare, a, 0, n, i );
3836
deepEqual( a[i], ref[i], "select #" + i );
3937
}

test/js/src/whole.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,14 @@ var check = function ( sortname, arraysort, ctor, n, comparename, compare ) {
1919

2020
test( title, function () {
2121

22-
var randint, sample, shuffle, a;
23-
24-
// SETUP RANDOM
25-
randint = random.randint;
26-
sample = random.__sample__( randint );
27-
shuffle = random.__shuffle__( sample );
22+
var a;
2823

2924
// SETUP ARRAY
3025
a = new ctor(n);
3126
array.iota( a, 0, n, 0 );
3227

3328
// SORT ARRAY
34-
shuffle( a, 0, n );
29+
random.shuffle( a, 0, n );
3530
arraysort( compare, a );
3631

3732
deepEqual( sort.issorted( compare , a , 0 , n ) , n , "check sorted" );

0 commit comments

Comments
 (0)