Skip to content

Commit

Permalink
buy me a coffe
Browse files Browse the repository at this point in the history
  • Loading branch information
ozzyZig1994 committed Oct 3, 2021
1 parent 4b5f43f commit 72738bd
Show file tree
Hide file tree
Showing 21 changed files with 707 additions and 172 deletions.
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,49 @@

Random pseudonumber generator with graphic interface.

## Multiplicative congruential algorithm

It arises from a Linear Sequential Algorithm , when $C$ = 0;

Then the equation is:

- $x_i$ + 1 = $(ax_i) mod (n) \to i = 0, 1, 2, 3, .... $

The advantage of this method is that compared to the linear algorithm, it involves one less operation.

The starting parameters of this algorithm are:

- $x_o$, $a$, $m$; which must be integers and greater than zero.
- To transform the numbers $x_i$ in the interval (0, 1), we look at the equation

- $r_i = x_i / (m - 1)$ $\to$ $m = 2 ^ g$

According to Banks, Carson, Nelson and Nicol, the conditions that must be met by the parameters for the multiplicative sequential algorithm to reach its maximum period are

- $a = 5 + 8k \to k = 1, 2, 3, ... $

$x_o$ must be an odd number and $g$ must be an integer.

From these conditions a maximum lifetime is achieved.

### Example

Generate enough numbers between 0 and 1 with the parameters: $x_o = 3$, $k = 5$ and $g = 8$ to find the life cycle period.

Formulas:

- $a = 5 + 8(2)$
- $m = g ^ 8$
- $x_i + 1 = (ax_i) mod (m)$
- $r_i = x_i / (m - 1).$

![](./appScreen.PNG)

Features:

- Uniformity test calculation
- Independence Test Calculation

If you wish to support my content it would be super appreciated a help from you!

[![](./bmc-button.png)](https://www.buymeacoffee.com/josuegalvan)
Binary file added appScreen.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bmc-button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified build/classes/algoritmosimulacion/Funciones.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified build/classes/algoritmosimulacion/congruencialMultiplicativo.class
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
</Component>
<Component class="javax.swing.JButton" name="jButton5">
<Properties>
<Property name="text" type="java.lang.String" value="Prubea independencia"/>
<Property name="text" type="java.lang.String" value="Prueba independencia"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton5ActionPerformed"/>
Expand Down
64 changes: 64 additions & 0 deletions build/classes/algoritmosimulacion/numeros
Original file line number Diff line number Diff line change
Expand Up @@ -621,3 +621,67 @@
0.1429
0.7143
0.1429
0.5294
0.7333
0.8745
0.2
0.9686
0.4196
0.8118
0.3882
0.4039
0.1059
0.749
0.5765
0.8431
0.7961
0.6863
0.7647
0.2784
0.4824
0.6235
0.9529
0.7176
0.1686
0.5608
0.1373
0.1529
0.8588
0.498
0.3255
0.5922
0.5451
0.4353
0.5137
0.0275
0.2314
0.3725
0.702
0.4667
0.9216
0.3098
0.8902
0.9059
0.6078
0.2471
0.0745
0.3412
0.2941
0.1843
0.2627
0.7804
0.9843
0.1216
0.451
0.2157
0.6706
0.0588
0.6392
0.6549
0.3569
1.0
0.8275
0.0902
0.0431
0.9373
0.0118
679 changes: 515 additions & 164 deletions nbproject/build-impl.xml

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions nbproject/genfiles.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
build.xml.data.CRC32=ae7fb679
build.xml.script.CRC32=19837e9b
build.xml.stylesheet.CRC32=8064a381@1.79.1.48
build.xml.stylesheet.CRC32=f85dc8f2@1.99.0.48
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=ae7fb679
nbproject/build-impl.xml.script.CRC32=741359ae
nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48
nbproject/build-impl.xml.script.CRC32=e70c0cd9
nbproject/build-impl.xml.stylesheet.CRC32=d549e5cc@1.99.0.48
2 changes: 1 addition & 1 deletion nbproject/private/private.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
compile.on.save=true
user.properties.file=C:\\Users\\adio_\\AppData\\Roaming\\NetBeans\\8.2\\build.properties
user.properties.file=C:\\Users\\adio_\\AppData\\Roaming\\NetBeans\\12.4\\build.properties
4 changes: 3 additions & 1 deletion nbproject/private/private.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group/>
<group>
<file>file:/C:/Users/adio_/Documents/pseudo-random-number-generator/src/algoritmosimulacion/congruencialMultiplicativo.java</file>
</group>
</open-files>
</project-private>
12 changes: 12 additions & 0 deletions nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ build.test.results.dir=${build.dir}/test/results
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.modulepath=\
${run.modulepath}
debug.test.classpath=\
${run.test.classpath}
debug.test.modulepath=\
${run.test.modulepath}
# Files in build.classes.dir which should be excluded from distribution jar
dist.archive.excludes=
# This directory is removed when the project is cleaned:
Expand All @@ -34,13 +38,17 @@ javac.classpath=
javac.compilerargs=
javac.deprecation=false
javac.external.vm=true
javac.modulepath=
javac.processormodulepath=
javac.processorpath=\
${javac.classpath}
javac.source=1.8
javac.target=1.8
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
javac.test.modulepath=\
${javac.modulepath}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=
Expand All @@ -66,9 +74,13 @@ run.classpath=\
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
# To set system properties for unit tests define test-sys-prop.name=value:
run.jvmargs=
run.modulepath=\
${javac.modulepath}
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
run.test.modulepath=\
${javac.test.modulepath}
source.encoding=UTF-8
src.dir=src
test.src.dir=test
2 changes: 1 addition & 1 deletion src/algoritmosimulacion/congruencialMultiplicativo.form
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
</Component>
<Component class="javax.swing.JButton" name="jButton5">
<Properties>
<Property name="text" type="java.lang.String" value="Prubea independencia"/>
<Property name="text" type="java.lang.String" value="Prueba independencia"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton5ActionPerformed"/>
Expand Down
2 changes: 1 addition & 1 deletion src/algoritmosimulacion/congruencialMultiplicativo.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
}
});

jButton5.setText("Prubea independencia");
jButton5.setText("Prueba independencia");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
Expand Down
64 changes: 64 additions & 0 deletions src/algoritmosimulacion/numeros
Original file line number Diff line number Diff line change
Expand Up @@ -621,3 +621,67 @@
0.1429
0.7143
0.1429
0.5294
0.7333
0.8745
0.2
0.9686
0.4196
0.8118
0.3882
0.4039
0.1059
0.749
0.5765
0.8431
0.7961
0.6863
0.7647
0.2784
0.4824
0.6235
0.9529
0.7176
0.1686
0.5608
0.1373
0.1529
0.8588
0.498
0.3255
0.5922
0.5451
0.4353
0.5137
0.0275
0.2314
0.3725
0.702
0.4667
0.9216
0.3098
0.8902
0.9059
0.6078
0.2471
0.0745
0.3412
0.2941
0.1843
0.2627
0.7804
0.9843
0.1216
0.451
0.2157
0.6706
0.0588
0.6392
0.6549
0.3569
1.0
0.8275
0.0902
0.0431
0.9373
0.0118

0 comments on commit 72738bd

Please sign in to comment.