> On May 31, 2018, 7:47 p.m., Meng Zhu wrote: > > src/master/allocator/sorter/random/utils.hpp > > Lines 53-59 (patched) > > > > > > Why do we need to construct the random distribution every time? How about: > > > > ``` > > std::uniform_real_distribution<> dis(0.0, 1.0); > > for (...) { > > ... > > keys[i] = 0.0 - std::pow(dis(urbg), (1.0 / weights[i])); > > } > > ``` It seemed a little more readable to me, and I assumed the cost was very low (e.g. no memory allocation). Would be good to pull it out if that's not the case! - Benjamin ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/67369/#review204090 ----------------------------------------------------------- On May 30, 2018, 12:55 a.m., Benjamin Mahler wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/67369/ > ----------------------------------------------------------- > > (Updated May 30, 2018, 12:55 a.m.) > > > Review request for mesos, Gaston Kleiman, Greg Mann, and Meng Zhu. > > > Bugs: MESOS-8936 > https://issues.apache.org/jira/browse/MESOS-8936 > > > Repository: mesos > > > Description > ------- > > This will be used by the random sorter in order to support weights. > > > Diffs > ----- > > src/Makefile.am b7184ceccef5f2e985d905c155156f95c7a7c7b4 > src/master/allocator/sorter/random/utils.hpp PRE-CREATION > > > Diff: https://reviews.apache.org/r/67369/diff/1/ > > > Testing > ------- > > Test added in subsequent patch. > > > Thanks, > > Benjamin Mahler > >