Skip to content

Instantly share code, notes, and snippets.

@carlopi
Created June 26, 2020 11:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carlopi/bbe90f8fc9ad9a1c3a3f2c749a0d11a2 to your computer and use it in GitHub Desktop.
Save carlopi/bbe90f8fc9ad9a1c3a3f2c749a0d11a2 to your computer and use it in GitHub Desktop.
shuffle.cpp
#include <algorithm>
#include <random>
#include <cheerp/types.h>
[[cheerp::jsexport]] void shuffle(client::Array& array)
{
std::random_device rd;
std::default_random_engine rng (rd());
std::shuffle (&array[0], &array[array.get_length()], rng);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment