+ 8

Random Class for CPP suggestions for improvements

Hello i have just made a Random Class for CPP, if there are suggestions for improvements please let me know https://code.sololearn.com/cMvGHpMRXvG2

21st Jan 2018, 6:17 PM
Thor Westergren
Thor Westergren - avatar
3 Respuestas
+ 8
I have made some more changes. Now it's a template and can return: int, ASCII characters and floats https://code.sololearn.com/c69x0TgNRMpo
24th Jan 2018, 7:09 AM
Thor Westergren
Thor Westergren - avatar
+ 7
Thanks Kinshuk Vasisht I have made the first changes. Now it's a template and can return ASCII characters, not yet floats https://code.sololearn.com/cMzs7760Rj4j
21st Jan 2018, 5:50 PM
Thor Westergren
Thor Westergren - avatar
+ 4
Sir, I just have one suggestion. Why not upgrade the class and make it a template class to return random characters, floats, etc? Eg - random<char> randchar; cout<<randchar.retrieve(); // The retrieve function will have to be // specialized for all the types, though. And it will be better to use the new <random> header introduced in C++03.
21st Jan 2018, 3:21 PM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar