#include "SkRandom.h" #includeint main() { SkRandom rand; for (int i = 0; i < 10; i++) { std::cout << rand.nextF() << std::endl; } return 0; }
#include "SkRandom.h" #includeThis example shows how SkRandom can be used to generate and write to a file 1000 unsigned integers in the range of 0-4294967295. The method nextU() generates a random unsigned integer. Overall, SkRandom is a useful and easy-to-use random number generator in C++ that is part of the Skia graphics library package.int main() { SkRandom rand; std::ofstream outfile("random_numbers.txt"); for (int i = 0; i < 1000; i++) { outfile << rand.nextU() << std::endl; } outfile.close(); return 0; }