GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::experimental::randint(3) C++ Standard Libary std::experimental::randint(3)

std::experimental::randint - std::experimental::randint


Defined in header <experimental/random>
template <class IntType> (library fundamentals TS v2)
IntType randint(IntType a, IntType b);


Generates a random integer in the closed interval [a, b].


a, b - integer values specifying the range


A random integer i in the closed interval [a, b], produced using a thread-local
instance of std::uniform_int_distribution<IntType> invoked with the per-thread
random number engine.


Remarks


If IntType is not one of short, int, long, long long, unsigned short, unsigned int,
unsigned long, or unsigned long long, the program is ill-formed.


The behavior is undefined if a > b.

// Run this code


#include <iostream>
#include <experimental/random>


int main()
{
int random_number = std::experimental::randint(100, 999);
std::cout << "random 3-digit number: " << random_number << '\n';
}


random 3-digit number: 273


reseed reseeds the per-thread random engine
(function)

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.