I wonder how one would go about coding weighted random in C++—having a random outcome but where you can control the outcome percentage of each result. I have searched the web but have yet to find anything but the Javascript version.
I want to program a question game, which I have programmed in python previously without being able to controll the percentages. Still, I want to transfer the program to C++ as there is more controllability. The program would have a list of questions; currently, the python version has just multiplication table questions, but I would like to have other genres of questions once I get this weighted random figured out. So far, I have been able to get the python code to stop asking a question that was correctly answered. Still, I would like it to slightly lessen the chance of it appearing as a question instead of it just not appearing after correctly answered once. If someone can explain how to get a weighted random in C++, I can transfer the rest of the code to C++ without issue.