fun3.cpp 338 Bytes
#include <algorithm>
#include <iostream>
#include <stdlib.h>
#include <time.h>
#include <vector>
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;
};