#include <vector>
#include <random>
std::vector<double> result(100);
std::uniform_real_distribution<double> unif(-10.0, 10.0);
std::default_random_engine re;
for (int i = 0; i < 100; ++i) {
result[i] = unif(re);
}
std::sort(result.begin(), result.end());
float r = ((float)(rand()) / RAND_MAX) * 20 - 10;
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char **argv)
{
int i, num;
if (argc > 1)
{
sscanf(argv[1], "%d", &num);
}
else
{
num = 0;
}
for (i = 0; i < num; i++)
{
float r;
r = ((float)(rand()) / RAND_MAX) * 20 - 10;
printf("%3.6f\n", r);
}
return 0;
}