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
  • randomSubvector(V) randomly get a subvector from a vector V
  • randomSubvector(V, L) randomly get a subvector with length L from a vector V
  • randomSubvector(V) randomly get a subvector from a vector V
  • randomSubvector(V, L) randomly get a subvector with length L from a vector V
  • randomSubstring(S) randomly get a substring from a string S
  • randomSubstring(S, L) randomly get a substring with length L from a string S
  • randomSubsequence(V) randomly get a subsequence from a vector or string V
  • randomSubsequence(V, L) randomly get a subsequence with length L from a vector or string V
Clone this wiki locally