Check out example codes for "how to get a random element from a vector c++ string". It will help you in understanding the concepts better.

Code Example 1

#include <iostream>
#include <vector>
using std::string; 

int main()
{
  std::vector <string> some_vector {"pizza", "burger", "fries", "chicken"}; 
  
  string random = some_vector[rand() % some_vector.size()]; 
  std::cout << random << "\n"; 
 
  
  return 0;
}

Learn ReactJs, React Native from akashmittal.com