Skip to content

Commit 86818bd

Browse files
committed
Add sample/check-output.cpp for output verification
1 parent 092ee1a commit 86818bd

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

sample/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
set(SAMPLE_TARGETS basic_usage pcg-demo codebook cppref-sample make-partytrick)
1+
set(SAMPLE_TARGETS basic_usage pcg-demo codebook cppref-sample make-partytrick check-output)
22

33
foreach(sample ${SAMPLE_TARGETS})
44
add_executable(${sample} ${sample}.cpp)

sample/check-output.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include <iostream>
2+
#include <iomanip>
3+
#include "pcg_random.hpp"
4+
5+
int main() {
6+
pcg32 rng(42u); // Seed with 42
7+
std::cout << "First 10 random numbers from pcg32(42):" << std::endl;
8+
for(int i=0; i<10; ++i) {
9+
std::cout << std::setw(12) << rng() << ((i+1)%5 == 0 ? "\n" : " ");
10+
}
11+
return 0;
12+
}

0 commit comments

Comments
 (0)