MCPcopy Create free account
hub / github.com/EasyRPG/Player / ShuffleRange

Method ShuffleRange

src/game_variables.cpp:518–525  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

516}
517
518void Game_Variables::ShuffleRange(int first_id, int last_id) {
519 PrepareRange(first_id, last_id, "Invalid write shuffle(var[{},{}])!");
520 auto& vv = _variables;
521 for (int i = std::max(0, first_id - 1); i < last_id; ++i) {
522 int rnd_num = Rand::GetRandomNumber(first_id, last_id) - 1;
523 std::swap(vv[i], vv[rnd_num]);
524 }
525}
526
527void Game_Variables::SetArray(int first_id_a, int last_id_a, int first_id_b) {
528 PrepareArray(first_id_a, last_id_a, first_id_b, "Invalid write var[{},{}] = var[{},{}]!");

Callers 1

Calls 1

maxFunction · 0.85

Tested by

no test coverage detected