Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Random Vector Generator
#include <bits/stdc++.h> using namespace std; #define ld long double #define vld vector<ld> vld generateRandomVector(int n, int start, int end) { srand(time(0)); vld ans(n); for(int i = 0; i < n; i++) { ans[i] = (end - start) * (rand() * 1.0 / INT_MAX) + start; } return ans; } int main() { int n = 10; int start = 10; int end = 20; vld ans; ans = generateRandomVector(n, start, end); for(auto x : ans) { cout << x << "\n"; } } // 0 to INT_MAX
run
|
edit
|
history
|
help
0
Widget Class with dynamic memory and pointers
Test Swap Functions
krack
Proyecto1
VecScalMultiOpLaod
多态
Six Trigonometric Functions
My Tuple class
Testing C++
Const Return Test