Skip to content

Utility Functions

afaji edited this page Mar 20, 2017 · 3 revisions

By including any of tcrand header, you will enable tcrand utility functions that you can use. Alternatively, you can use #include <tcrand/utility.hpp> just to specifically introduce these functions.

tcrand provides you with the function below:

  • rand_int(A, B) randomly get an integer from A to B
  • rand_int(A) randomly get an integer from 0 to A-1
  • rand_long(A, B) randomly get a long long from A to B
  • rand_long(A) randomly get a long long from 0 to A-1
  • rand_double(A, B) randomly get a double from A to B
  • rand_double(A) randomly get a double from 0 to A
  • rand_subarray(V) randomly get a subarray from a vector or string V
  • rand_subarray(V, L) randomly get a subarray with length L from a vector or string V
  • rand_subsequence(V) randomly get a subsequence from a vector or string V
  • ** rand_subsequence(V, L)** randomly get a subsequence with length L from a vector or string V
Clone this wiki locally