-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add API for Random numbers (OS-dependent) (#14) #15
base: dev
Are you sure you want to change the base?
Conversation
Currently POSIX-only.
e094458
to
fa34085
Compare
@@ -0,0 +1,16 @@ | |||
#include "FlameIDE/Common/PrimitiveTypes.hpp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use <>
. And I think this string can be removed.
{ | ||
|
||
|
||
flame_ide::primitive_types::ssize_t RandomRange(void *buf, flame_ide::primitive_types::size_t size) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use flame_ide::Types
from Numbers.hpp
return RandomRange(&result, sizeof(T)) == sizeof(T) ? result : 0; | ||
} | ||
|
||
}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add comment to the end of namespaces
return getrandom(buf, size, 0); | ||
} | ||
|
||
}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add comment to the end of namespaces
{namespace os | ||
{ | ||
|
||
flame_ide::primitive_types::ssize_t RandomRange(void *buf, flame_ide::primitive_types::size_t size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
randomRange()
/// It fills all bytes of returned value. | ||
/// @tparam T Integral type used for returned value (default is int). | ||
template <typename T = flame_ide::primitive_types::int_t> | ||
typename EnableType<IsIntegralValue<T>, T>::Type Random() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
random()
Closes #14 .