[
https://issues.apache.org/jira/browse/RNG-143?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17358613#comment-17358613
]
Alex Herbert commented on RNG-143:
----------------------------------
bq. Isn't it called by the new instance methods?
But it doesn't have to be. That was to illustrate how simple a change this is.
More formally it would be:
{code:java}
public RestorableUniformRandomProvider create() {
return ProviderBuilder.create(getInternalIdentifier());
}
public RestorableUniformRandomProvider create(Object seed,
Object... data) {
return ProviderBuilder.create(getInternalIdentifier(), seed, data);
}
{code}
> 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)