Shows how to use xtd::random::next method.
#include <xtd/console>
#include <xtd/random>
 
 
auto main() -> int {
  auto male_pet_names = 
list {
"Rufus", 
"Bear", 
"Dakota", 
"Fido", 
"Vanya", 
"Samuel", 
"Koani", 
"Volodya", 
"Prince", 
"Yiska"};
 
  auto female_pet_names = 
list {
"Maggie", 
"Penny", 
"Saya", 
"Princess", 
"Abby", 
"Laila", 
"Sadie", 
"Olivia", 
"Starlight", 
"Talla"};
 
  
  
  auto male_index = rnd.next(male_pet_names.size());
  auto female_index = rnd.next(female_pet_names.size());
  
  
  console::write_line("Suggested pet name of the day: ");
  console::write_line("   For a male:     {0}", male_pet_names[male_index]);
  console::write_line("   For a female:   {0}", female_pet_names[female_index]);
}
 
Represents a strongly typed list of objects that can be accessed by index. Provides methods to search...
Definition list.hpp:71
 
Represents a pseudo-random number generator, a device that produces a sequence of numbers that meet c...
Definition random.hpp:40
 
The xtd::collections::generic namespace contains interfaces and classes that define generic collectio...
Definition comparer.hpp:15
 
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10