Skip to content

Utility Functions

afaji edited this page Mar 15, 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:

  • randInt(A, B) randomly get an integer from A to B
  • randInt(A) randomly get an integer from 0 to A-1
  • randLongLong(A, B) randomly get a long long from A to B
  • randLongLong(A) randomly get a long long from 0 to A-1
  • randDouble(A, B) randomly get a double from A to B
  • randDouble(A) randomly get a double from 0 to A
  • random_subvetor(V) randomly get a subvector from a vector V
  • random_subvetor(V, L) randomly get a subvector with length L from a vector V
  • random_subvetor(V) randomly get a subvector from a vector V
  • random_subvetor(V, L) randomly get a subvector with length L from a vector V
  • random_substring(S) randomly get a substring from a string S
  • ** random_substring(S, L)** randomly get a substring with length L from a string S
Clone this wiki locally