PanzerKadaver
PanzerKadaver

Reputation: 363

Equivalent of random(3) on Win?

I program in C++ on open-suse (with emacs) and on windows 8 (with VS). For some reasons, I'm forced to use the random() (man 3 random), of stdlib.h.

But, on VS, it appears random() doesn't exist and rand() returns me an int, and of course, I need a long int (like what random() returns).

Is there an alternative to have the same result in both system with the same seed ?

Upvotes: 1

Views: 134

Answers (1)

Zac Howland
Zac Howland

Reputation: 15870

The C++11 standard added <random> which gives you a wide range of different psuedo-random number generators.

Upvotes: 2

Related Questions