[ruby-core:98354] [Ruby master Feature#16827] C API for writing custom random number generator that can be used as Random objects
From:
eregontp@...
Date:
2020-05-14 12:33:11 UTC
List:
ruby-core #98354
Issue #16827 has been updated by Eregon (Benoit Daloze). IMHO it's not nice to replace a nice Ruby-level API by a C API one. Is there a benchmark of how much is it slower with `rb_funcallv_public`? Also, will it still work when passing a custom object understanding `rand`? If so, there are two ways to dispatch, doesn't seem nice either API-wise. ---------------------------------------- Feature #16827: C API for writing custom random number generator that can be used as Random objects https://bugs.ruby-lang.org/issues/16827#change-85622 * Author: mrkn (Kenta Murata) * Status: Open * Priority: Normal * Assignee: matz (Yukihiro Matsumoto) ---------------------------------------- I want to write custom random number generators (RNGs) that can be used as an alternative to a Random object. Now custom RNGs with `#rand` method can be used for that purpose, but there is the method call overhead in the current implementation because `#rand` method is called through `rb_funcallv_public`. I want C API for writing RNGs because all of the random number generator algorithms I want to write are originally written in C. Nobu already created [a pull-request](https://github.com/ruby/ruby/pull/3024) for such purpose. -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>