brintos

brintos / llvm-project-archived public Read only

0
0
Text · 976 B · 0015664 Raw
21 lines · plain
1.. title:: clang-tidy - misc-predictable-rand2 3misc-predictable-rand4=====================5 6Warns for the usage of ``std::rand()``. Pseudorandom number generators use7mathematical algorithms to produce a sequence of numbers with good8statistical properties, but the numbers produced are not genuinely random.9The ``std::rand()`` function takes a seed (number), runs a mathematical10operation on it and returns the result. By manipulating the seed the result11can be predictable.12 13References14----------15 16This check corresponds to the CERT C Coding Standard rules17`MSC30-C. Do not use the rand() function for generating pseudorandom numbers18<https://wiki.sei.cmu.edu/confluence/display/c/MSC30-C.+Do+not+use+the+rand%28%29+function+for+generating+pseudorandom+numbers>`_.19`MSC50-CPP. Do not use std::rand() for generating pseudorandom numbers20<https://wiki.sei.cmu.edu/confluence/display/cplusplus/MSC50-CPP.+Do+not+use+std%3A%3Arand%28%29+for+generating+pseudorandom+numbers>`_.21