Mageia Bugzilla – Attachment 7212 Details for
Bug 17126
gcc (libstdc++) new security issue CVE-2015-5276
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
Test file for C++
random.cc (text/plain), 712 bytes, created by
Len Lawrence
on 2015-11-18 19:45:56 CET
(
hide
)
Description:
Test file for C++
Filename:
MIME Type:
Creator:
Len Lawrence
Created:
2015-11-18 19:45:56 CET
Size:
712 bytes
patch
obsolete
>#include <iostream> >#include <string> >#include <map> >#include <random> > >int main() >{ > std::random_device rd; > std::map<int, int> hist; > std::uniform_int_distribution<int> dist(0, 9); > for (int n = 0; n < 20000; ++n) { > ++hist[dist(rd)]; // note: demo only: the performance of many > // implementations of random_device degrades sharply > // once the entropy pool is exhausted. For practical use > // random_device is generally only used to seed > // a PRNG such as mt19937 > } > for (auto p : hist) { > std::cout << p.first << " : " << std::string(p.second/100, '*') << '\n'; > } >}
#include <iostream> #include <string> #include <map> #include <random> int main() { std::random_device rd; std::map<int, int> hist; std::uniform_int_distribution<int> dist(0, 9); for (int n = 0; n < 20000; ++n) { ++hist[dist(rd)]; // note: demo only: the performance of many // implementations of random_device degrades sharply // once the entropy pool is exhausted. For practical use // random_device is generally only used to seed // a PRNG such as mt19937 } for (auto p : hist) { std::cout << p.first << " : " << std::string(p.second/100, '*') << '\n'; } }
View Attachment As Raw
Actions:
View
Attachments on
bug 17126
: 7212