%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home2/rezakur1/ai.rezakurnia.com/zh-router-frontend/node_modules/es-toolkit/dist/array/
Upload File :
Create Path :
Current File : //home2/rezakur1/ai.rezakurnia.com/zh-router-frontend/node_modules/es-toolkit/dist/array/sample.js

// src/array/sample.ts
/**
* Returns a random element from an array.
*
* This function takes an array and returns a single element selected randomly from the array.
*
* @template T - The type of elements in the array.
* @param arr - The array to sample from.
* @returns A random element from the array.
*
* @example
* const array = [1, 2, 3, 4, 5];
* const randomElement = sample(array);
* // randomElement will be one of the elements from the array, selected randomly.
*/
function sample(arr) {
	return arr[Math.floor(Math.random() * arr.length)];
}
exports.sample = sample;

Zerion Mini Shell 1.0