asuhan commented on a change in pull request #11864:
URL: https://github.com/apache/arrow/pull/11864#discussion_r762877446



##########
File path: cpp/src/arrow/compute/kernels/random.cc
##########
@@ -0,0 +1,55 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "arrow/util/random.h"
+#include "arrow/compute/kernel.h"
+#include "arrow/compute/kernels/common.h"
+#include "arrow/compute/registry.h"
+
+#include <random>
+
+namespace arrow {
+namespace compute {
+namespace internal {
+namespace {
+
+Status ExecRandom(KernelContext* ctx, const ExecBatch& batch, Datum* out) {
+  std::random_device rd;
+  std::mt19937 gen(rd());
+  float value = random::generate_canonical<float>(gen);
+  BoxScalar<FloatType>::Box(value, out->scalar().get());
+  return Status::OK();

Review comment:
       @cyb70289 I'm aware of the history of it, that's why I made it a draft. 
Just wanted to have the structure in place and trigger CI.
   
   I've tried PCG but I maybe I'm holding it wrong since it only generates 0, 
haven't really looked into it. I just used `std::mt19937` to get this going, 
which kinda defeats the purpose of providing our own random algorithm anyway.
   
   I'd go with STL, yes. It's not clear to me from previous discussion why 
we're reluctant to just go with that.




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to