leezu commented on a change in pull request #12749: [MXNET-1029] Feature
request: randint operator
URL: https://github.com/apache/incubator-mxnet/pull/12749#discussion_r406948727
##########
File path: include/mxnet/random_generator.h
##########
@@ -63,6 +63,10 @@ class RandGenerator<cpu, DType> {
MSHADOW_XINLINE int rand() { return engine_->operator()(); }
+ MSHADOW_XINLINE int64_t rand_int64() {
+ return static_cast<int64_t>(engine_->operator()() << 31) +
engine_->operator()();
Review comment:
Yes, because you're concatenating 2 32bit numbers, where every bit is
uniformly random. Thus the resulting 64bits are uniformly random.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services