Skip to content

Commit 15ded21

Browse files
author
AndreyGeonya
committed
add richarddurstenfeld jsdoc
1 parent f7afa74 commit 15ded21

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

src/shuffle/fisheryates.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* var shuffle = require('path-to-algorithms/src/' +
1212
* 'shuffle/fisheryates').shuffle;
1313
* console.log(shuffle([1, 2, 3, 4, 5])); // shuffled array
14+
*
1415
* @public
1516
* @module shuffle/fisheryates
1617
* @param {Array} array Array which should be shuffled.

src/shuffle/richarddurstenfeld.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
(function (exports) {
2+
23
'use strict';
34

45
/**
56
* Shuffle of an array elements.
67
* This algorithm is modified version of Fisher-Yates shuffle
7-
* algorithm and is introduced by Richard Durstenfeld.
8-
*/
9-
10-
/**
11-
* Shuffles an array. Complexity O(n).
8+
* algorithm and is introduced by Richard Durstenfeld.<br><br>
9+
* Time complexity: O(N).
10+
*
11+
* @example
12+
* var shuffle = require('path-to-algorithms/src/shuffle' +
13+
* '/richarddurstenfeld').shuffle;
14+
* console.log(shuffle([1, 2, 3, 4, 5])); // random shuffled
1215
*
13-
* @param {array} array An array which should be shuffled
14-
* @returns {array} Shuffled array
16+
* @public
17+
* @module shuffle/richarddurstenfeld
18+
* @param {Array} array An array which should be shuffled.
19+
* @return {Array} Shuffled array.
1520
*/
1621
function shuffle(array) {
1722
var arraySize = array.length - 1;

0 commit comments

Comments
 (0)