#include <algorithm>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <list>
using namespace std;
int main( )
{
list<int> data( 100000 );
// create random numbers
generate( data.begin(), data.end(), rand );
// make them go from 0 to 200
transform( data.begin(), data.end(), data.begin(),bind2nd( modulus<int>(), 201 ) );
// make them go from -100 to 100
transform( data.begin(), data.end(), data.begin(),bind2nd( minus<int>(), 100 ) );
}
|