fun3.cpp 339 Bytes
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdlib.h>
#include <time.h>
using namespace std;

int
main ()
{
  srandom (time (NULL));
  vector < long >v (10);
  generate (v.begin (), v.end (), random);
  cout << count_if (v.begin (), v.end (),
		    [](long i) -> bool { return i > RAND_MAX >> 1;  } ) << endl;

};