Created
June 26, 2020 11:51
-
-
Save carlopi/bbe90f8fc9ad9a1c3a3f2c749a0d11a2 to your computer and use it in GitHub Desktop.
shuffle.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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