Skip to content

Shuffle lists based on Fisher-Yates shuffle algorithm

License

Notifications You must be signed in to change notification settings

hectortosa/shufflr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shufflr

NPM Shufflr crates.io Shufflr

JavaScript CI Rust CI

Shuffle lists based on Fisher-Yates shuffle algorithm

Using shufflr

Shufflr is available for Rust as crates.io package and for JavaScript as NPM package.

Rust

To use shufflr in your project simply follow this steps:

Add shufflr to your Cargo.toml:

    [dependencies]
    shufflr = "0.1.0"

Import shufflr in your Rust code:

    use shufflr::shuffle;

Use shuffle method with an array to get a copy of it shuffled:

    let shuffled_array = shuffle(&original_array);

JavaScript

Install shufflr (trying to cover all package manager nowadays):

    npm i shufflr

Or:

    pnpm add shufflr

Or:

    yarn add shufflr

Or:

    bun add shufflr

Import shufflr in your JavaScript code:

    var shufflr = require('shufflr');

Or:

    import { shuffle } from 'shufflr';

Use shuffle method with an array to get a copy of it shuffled:

    var shuffledArray = shufflr.shuffle(originalArray)

Or:

    var shuffledArray = shuffle(originalArray)

Develop

Rust

After cloning the repository, build the project with:

    cargo build

To run shufflr tests simply run:

    cargo test

JavaScript

After cloning the repository, install the dev dependencies (shufflr does not have runtime dependencies):

    npm install

To run shufflr tests simply run:

    npm run test

❤️ Like the project?

If you like this project (or any other) and want to help me contiue to improve it or create new ones, check my Ko-fi profile and consider buying me a Speciality Coffee:

ko-fi