[jira] [Commented] (RNG-16) Linear congruential generators
[ https://issues.apache.org/jira/browse/RNG-16?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16868539#comment-16868539 ] Alex D Herbert commented on RNG-16: --- The reference LCG implementations listed on wikipedia from many libraries are legacy generators designed when 64-bit arithmetic was expensive. Many output only 16-bits from a 32-bit state so avoiding the lower bits which have a period of 2^n where n is the bit index from the least significant upward. Adding matching implementations of these generators to the Commons RNG library to match exactly the output of those generators would fail to satisfy the contract of the UniformRandomProvider interface. For example the nextInt() method should output a full 32-bit integer (positive and negative). To satisfy theses requirements means breaking the compatibility with the primary output from the reference. Consequently these generators would be unsuitable for general purpose use for any code expecting a functional UniformRandomProvider. It seems odd to add such restricted generators to satisfy a requirement of a standard cross platform generator. Which one should be the standard? If we match them all in Java then you have a situation where your client can be written in Java and the other language where the generator is standard. But you may be limited to 2 languages which share a generator. In addition the term 'standard' is loosely applied. If the language does not provide explicitly the formula for the LCG then it is subject to change without notice. They are only standard if the language defines them as such. The hypothetical situation given is: * A client is to be written by a third party in a language of their choice * The client must be able to generate the same random events This situation seems to be better satisfied by defining the generator that a client must implement using pseudocode and providing an example output given a chosen seed. The producer of the client is responsible for writing the generator. The writing of a generator is a small piece of the total code to create a client. It seems to be out of scope for Commons RNG to implement legacy generators from multiple platforms given their failings under modern standards for randomness ([Dieharder|https://webhome.phy.duke.edu/~rgb/General/dieharder.php] and [BigCrush|http://simul.iro.umontreal.ca/testu01/tu01.html]). Of the reference LCGs listed some use long arithmetic and output 32-bits of the state per cycle. These generators are candidates for addition to the library as they may produce acceptable random output. Implementations are being developed and tested using Dieharder and BigCrush to determine if the performance is comparable to the LCG implemented in Java's own java.util.Random. Results of quality (randomness) and performance (speed) tests will be posted here to determine if these generators have merit. > Linear congruential generators > -- > > Key: RNG-16 > URL: https://issues.apache.org/jira/browse/RNG-16 > Project: Commons RNG > Issue Type: Sub-task >Reporter: Emmanuel Bourg >Priority: Minor > Labels: gsoc2019 > > This is a RFE for implementing linear congruential generators: > https://en.wikipedia.org/wiki/Linear_congruential_generator > This type of random generator is often used in language runtimes (Borland C, > GCC, Delphi, VB and even Java). Preconfigured generators using the same > parameters as these languages would be convenient for reproducing the same > number sequences in Java. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (RNG-16) Linear congruential generators
[ https://issues.apache.org/jira/browse/RNG-16?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16865548#comment-16865548 ] Abhishek Singh Dhadwal commented on RNG-16: --- Hello, I shall be working on the task at hand. Upon discussion with Gilles and Alex Herbert, following are the details about the plan for implementation of the RNG. There shall be a base abstract class (AbstractLCG) which shall take inputs of a,c,m and the seed and return integer values as required. There shall be a child class (KnuthLewisLCG) which shall extend the aforementioned class with the values of a, c and m referred from [Numerical Recipes |https://en.wikipedia.org/wiki/Linear_congruential_generator#Parameters_in_common_use] The current questions/queries at hand are : * Will it pass the test suite? * Can using modulo 2^32 increase performance (to be tested using JMH) * Comparison between KnuthLewisDirect and the aforementioned child class > Linear congruential generators > -- > > Key: RNG-16 > URL: https://issues.apache.org/jira/browse/RNG-16 > Project: Commons RNG > Issue Type: Sub-task >Reporter: Emmanuel Bourg >Priority: Minor > Labels: gsoc2019 > > This is a RFE for implementing linear congruential generators: > https://en.wikipedia.org/wiki/Linear_congruential_generator > This type of random generator is often used in language runtimes (Borland C, > GCC, Delphi, VB and even Java). Preconfigured generators using the same > parameters as these languages would be convenient for reproducing the same > number sequences in Java. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (RNG-16) Linear congruential generators
[ https://issues.apache.org/jira/browse/RNG-16?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15745927#comment-15745927 ] Gilles commented on RNG-16: --- To would-be contributors: Use of these generators is to be avoided. > Linear congruential generators > -- > > Key: RNG-16 > URL: https://issues.apache.org/jira/browse/RNG-16 > Project: Commons RNG > Issue Type: Sub-task >Reporter: Emmanuel Bourg >Priority: Minor > > This is a RFE for implementing linear congruential generators: > https://en.wikipedia.org/wiki/Linear_congruential_generator > This type of random generator is often used in language runtimes (Borland C, > GCC, Delphi, VB and even Java). Preconfigured generators using the same > parameters as these languages would be convenient for reproducing the same > number sequences in Java. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (RNG-16) Linear congruential generators
[ https://issues.apache.org/jira/browse/RNG-16?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15745822#comment-15745822 ] Gilles commented on RNG-16: --- FTR: http://markmail.org/message/brhdpc5hwjebc2z3 > Linear congruential generators > -- > > Key: RNG-16 > URL: https://issues.apache.org/jira/browse/RNG-16 > Project: Commons RNG > Issue Type: Wish >Reporter: Emmanuel Bourg >Priority: Minor > > This is a RFE for implementing linear congruential generators: > https://en.wikipedia.org/wiki/Linear_congruential_generator > This type of random generator is often used in language runtimes (Borland C, > GCC, Delphi, VB and even Java). Preconfigured generators using the same > parameters as these languages would be convenient for reproducing the same > number sequences in Java. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (RNG-16) Linear congruential generators
[ https://issues.apache.org/jira/browse/RNG-16?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15509916#comment-15509916 ] Emmanuel Bourg commented on RNG-16: --- Indeed > Linear congruential generators > -- > > Key: RNG-16 > URL: https://issues.apache.org/jira/browse/RNG-16 > Project: Commons RNG > Issue Type: Improvement >Reporter: Emmanuel Bourg >Priority: Minor > > This is a RFE for implementing linear congruential generators: > https://en.wikipedia.org/wiki/Linear_congruential_generator > This type of random generator is often used in language runtimes (Borland C, > GCC, Delphi, VB and even Java). Preconfigured generators using the same > parameters as these languages would be convenient for reproducing the same > number sequences in Java. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (RNG-16) Linear congruential generators
[ https://issues.apache.org/jira/browse/RNG-16?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15509829#comment-15509829 ] Gilles commented on RNG-16: --- bq The generator is defined by the protocol Ah, OK. Then, if every client software has to implement a generator (if the language provides a different one), then why not have the protocol define a good generator? But maybe that the protocol cannot be changed anymore... > Linear congruential generators > -- > > Key: RNG-16 > URL: https://issues.apache.org/jira/browse/RNG-16 > Project: Commons RNG > Issue Type: Improvement >Reporter: Emmanuel Bourg >Priority: Minor > > This is a RFE for implementing linear congruential generators: > https://en.wikipedia.org/wiki/Linear_congruential_generator > This type of random generator is often used in language runtimes (Borland C, > GCC, Delphi, VB and even Java). Preconfigured generators using the same > parameters as these languages would be convenient for reproducing the same > number sequences in Java. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (RNG-16) Linear congruential generators
[ https://issues.apache.org/jira/browse/RNG-16?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15509793#comment-15509793 ] Emmanuel Bourg commented on RNG-16: --- Actually every client will use the same random generator with the same parameters regardless of the language used. This ensures that all clients generate the same random events from the seed initially sent by the server. The generator is defined by the protocol, all clients know that they have to reproduce the behavior of the default GCC generator for example. > Linear congruential generators > -- > > Key: RNG-16 > URL: https://issues.apache.org/jira/browse/RNG-16 > Project: Commons RNG > Issue Type: Improvement >Reporter: Emmanuel Bourg >Priority: Minor > > This is a RFE for implementing linear congruential generators: > https://en.wikipedia.org/wiki/Linear_congruential_generator > This type of random generator is often used in language runtimes (Borland C, > GCC, Delphi, VB and even Java). Preconfigured generators using the same > parameters as these languages would be convenient for reproducing the same > number sequences in Java. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (RNG-16) Linear congruential generators
[ https://issues.apache.org/jira/browse/RNG-16?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15509746#comment-15509746 ] Gilles commented on RNG-16: --- The application looks interesting. But I'm not sure I understand the requirement: Is it foreseen that different clients (implemented in different languages, and using that language's standard "rand" generator) will generate the same sequence? >From the table on the Wikipedia page, it doesn't look like it'll fly (same >algorithm, but different multiplier/increment/truncation). An obvious way to ensure the same sequence, is to distribute all the numbers to the clients. True it is much more data to transfer. But it is also more secure and more flexible (e.g. the server can decide to switch to another generator at any time). I'm about to post on the "dev" ML to discuss the more general issue of what the contents of "Commons RNG" should be. > Linear congruential generators > -- > > Key: RNG-16 > URL: https://issues.apache.org/jira/browse/RNG-16 > Project: Commons RNG > Issue Type: Improvement >Reporter: Emmanuel Bourg >Priority: Minor > > This is a RFE for implementing linear congruential generators: > https://en.wikipedia.org/wiki/Linear_congruential_generator > This type of random generator is often used in language runtimes (Borland C, > GCC, Delphi, VB and even Java). Preconfigured generators using the same > parameters as these languages would be convenient for reproducing the same > number sequences in Java. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (RNG-16) Linear congruential generators
[ https://issues.apache.org/jira/browse/RNG-16?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15508983#comment-15508983 ] Emmanuel Bourg commented on RNG-16: --- The use case I have in mind is a game server distributing a seed to the clients and expecting them to generate an identical sequence of random events. Different implementations of the client in different languages need to be interoperable. > Linear congruential generators > -- > > Key: RNG-16 > URL: https://issues.apache.org/jira/browse/RNG-16 > Project: Commons RNG > Issue Type: Improvement >Reporter: Emmanuel Bourg >Priority: Minor > > This is a RFE for implementing linear congruential generators: > https://en.wikipedia.org/wiki/Linear_congruential_generator > This type of random generator is often used in language runtimes (Borland C, > GCC, Delphi, VB and even Java). Preconfigured generators using the same > parameters as these languages would be convenient for reproducing the same > number sequences in Java. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (RNG-16) Linear congruential generators
[ https://issues.apache.org/jira/browse/RNG-16?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15508075#comment-15508075 ] Gilles commented on RNG-16: --- bq. Preconfigured generators using the same parameters as these languages would be convenient for reproducing the same number sequences in Java. Out of curiosity, for what would it be used? > Linear congruential generators > -- > > Key: RNG-16 > URL: https://issues.apache.org/jira/browse/RNG-16 > Project: Commons RNG > Issue Type: Improvement >Reporter: Emmanuel Bourg >Priority: Minor > > This is a RFE for implementing linear congruential generators: > https://en.wikipedia.org/wiki/Linear_congruential_generator > This type of random generator is often used in language runtimes (Borland C, > GCC, Delphi, VB and even Java). Preconfigured generators using the same > parameters as these languages would be convenient for reproducing the same > number sequences in Java. -- This message was sent by Atlassian JIRA (v6.3.4#6332)