* 随机从一数组里面取 * @param arr * @param count * @returns {Buffer}
(arr, count)
| 610 | * @returns {Buffer} |
| 611 | */ |
| 612 | function getRandomArrayElements(arr, count) { |
| 613 | var shuffled = arr.slice(0), i = arr.length, min = i - count, temp, index; |
| 614 | while (i-- > min) { |
| 615 | index = Math.floor((i + 1) * Math.random()); |
| 616 | temp = shuffled[index]; |
| 617 | shuffled[index] = shuffled[i]; |
| 618 | shuffled[i] = temp; |
| 619 | } |
| 620 | return shuffled.slice(min); |
| 621 | } |
| 622 | function getAuthorShareCode(url) { |
| 623 | return new Promise(async resolve => { |
| 624 | const options = { |