Run Code
|
API
|
Code Wall
|
Users
|
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
Please
log in
to post a comment.
fibonacci
ListCPP
Print All Paths In Matrix
Menu Combination Sum
Proyecto 1
Bimap operations
134
cppPyGuessTheNum2
Microsoft Question - MaxEmployeeAttendence (original question)
substr
Please log in to post a comment.