You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gilles Sadowski (Jira)" <ji...@apache.org> on 2021/06/07 12:30:00 UTC

[jira] [Commented] (RNG-143) Instance create() method for RandomSource

    [ https://issues.apache.org/jira/browse/RNG-143?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17358563#comment-17358563 ] 

Gilles Sadowski commented on RNG-143:
-------------------------------------

{quote}
{code:java}
RandomSource.MT.create();
RandomSource.MT.create(12345L);
{code}
{quote}
Nicer indeed.
{quote}[...] static factory method redundant, which could be deprecated.
{quote}
Isn't it called by the new instance methods?

> Instance create() method for RandomSource
> -----------------------------------------
>
>                 Key: RNG-143
>                 URL: https://issues.apache.org/jira/browse/RNG-143
>             Project: Commons RNG
>          Issue Type: New Feature
>          Components: simple
>    Affects Versions: 1.3
>            Reporter: Alex Herbert
>            Priority: Trivial
>
> This is a wish for an instance {{create}} method for RandomSource:
> {code:java}
> public RestorableUniformRandomProvider create() {
>     return create(this);
> }
> public RestorableUniformRandomProvider create(Object seed,
>                                               Object... data) {
>     return create(this, seed, data);
> }
> {code}
> It is syntactic sugar to avoid typing the use of the static factory method and repeating {{RandomSource}} in close succession:
> {code:java}
> RandomSource.create(RandomSource.MT);
> RandomSource.create(RandomSource.MT, 12345L);
> {code}
> Becomes:
> {code:java}
> RandomSource.MT.create();
> RandomSource.MT.create(12345L);
> {code}
> It would make the use of the static factory method redundant, which could be deprecated.
> Opinions on this?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)