#include "myrandom.h" int myrandom::rand() { //As in C, but next is now a data member instead of a static variable. next = next * 1103515245 + 12345; return static_cast(next / 65536) % 32768; }