From 05d696b37a6f568128cc7432a1ff47f9dbd3af23 Mon Sep 17 00:00:00 2001 From: ChaiBapchya Date: Wed, 14 Nov 2018 11:38:31 -0800 Subject: [PATCH] formula update and removed itype --- include/mxnet/random_generator.h | 2 -- python/mxnet/symbol/random.py | 2 +- src/operator/random/sampler.h | 4 ++-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/include/mxnet/random_generator.h b/include/mxnet/random_generator.h index 7296305b96df..e7b419309cb7 100644 --- a/include/mxnet/random_generator.h +++ b/include/mxnet/random_generator.h @@ -55,8 +55,6 @@ class RandGenerator { public: typedef typename std::conditional::value, DType, double>::type FType; - typedef typename std::conditional::value, - DType, int>::type IType; explicit Impl(RandGenerator *gen, int state_idx) : engine_(gen->states_ + state_idx) {} diff --git a/python/mxnet/symbol/random.py b/python/mxnet/symbol/random.py index 53c2a48f4311..c5940ac96a50 100644 --- a/python/mxnet/symbol/random.py +++ b/python/mxnet/symbol/random.py @@ -303,5 +303,5 @@ def randint(low, high, shape=_Null, dtype=_Null, **kwargs): dtype : {'int32', 'int64'}, optional Data type of output samples. Default is 'int32' """ - return _random_helper(_internal._random_randint, _internal._sample_uniform, + return _random_helper(_internal._random_randint, None, [low, high], shape, dtype, kwargs) diff --git a/src/operator/random/sampler.h b/src/operator/random/sampler.h index 3e9147635a83..ca764e706c64 100644 --- a/src/operator/random/sampler.h +++ b/src/operator/random/sampler.h @@ -103,10 +103,10 @@ struct SampleRandIntKernel { index_t nBatch(1 + (nSample - 1) / nParm); if (sizeof(IType) == sizeof(int64_t)) out[i] = OType(lower[i / nBatch] + - (upper[i / nBatch] - lower[i / nBatch]) * genImpl.rand_int64()); + genImpl.rand_int64() % (upper[i / nBatch] - lower[i / nBatch])); else out[i] = OType(lower[i / nBatch] + - (upper[i / nBatch] - lower[i / nBatch]) * genImpl.rand()); + genImpl.rand() % (upper[i / nBatch] - lower[i / nBatch])); }); } };