-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.cpp
More file actions
22 lines (19 loc) · 762 Bytes
/
example.cpp
File metadata and controls
22 lines (19 loc) · 762 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "RandomPicker.h"
/////////////////////////////////////////////////////////////////////////////
// Name: example.h
// Purpose: RandomPicker: Random picker example
// Author: Mohd Radzi Ibrahim
// Modified by:
// Created: 13 July 2020
// Copyright: (c) MR Ibrahim
// Licence: GNU GENERAL PUBLIC LICENSE
/////////////////////////////////////////////////////////////////////////////
int main() {
Random::Picker<std::string> rp({"first", "second", "third", "next", "again", "next", "next"}); // this allows duplicate entries;
std::string delim = "";
for (auto r = rp.GetNextRandom(); r != nullptr; r = rp.GetNextRandom()) {
std::cout << delim << *r;
delim = ",";
}
std::cout << std::endl;
}