Thursday, August 17, 2017

Chaotic Numbers in Powershell Module

Chaotic Numbers in Powershell Module

All the details are on the Technet site: Source: Own Technet Site


Usually, all the random numbers that we got from a computer are called pseudo-random because they comply all statistics and rules to be called "random." Now, in other hands, we have an equation exposed in a Seminal paper by the biologist Robert May back to 1976, called "Logistic Map" is nothing but a quadratic equation that with the correct parameters can lead to a chaotics behaviors and from there we got the "True Random Generator number." Let's let the image talk.
This graph is what in physics related to the chaos we called, Bifurcation diagram. A bifurcation is when the dynamics of the graph that start in single line divides into 2, then into 4, then 8, and then do it every time more frequent until we got an undetermined number of bifurcations when the parameter r is 4. Ohh, the equation: please keep it in mind is this one:
This is the simplest equation that behaves chaotically if you see it good, it's just a quadratic equation. where the Xn+1 refers to the value in the next iteration, and x0 is the value from the previous iteration. I used the "pseudo-random" generator, just to pick a random number in x0 (to kick off the equation values for x1,x2,x3,...Xn). This equation to run you need to set a number of iterations and a number of transients, the first element is related a how many times will execute the iterations, and the second one is related to how many values it will discard before taking values, this basically is because even in chaos you need to wait for some stabilization of the "system", in our case the logistic equation works to study some dynamic systems. So The defaults values of my script will be: Iterations = 5000 Transient = 2000 (Note that it follows the equation "Iterations = transient + 3000" And this must be true always, it's not required for the system, this condition I put it arbitrarily to make sure you are in the chaos.) Numbers = 1 Numbers is related to the number of random numbers that you want. If you use any negative value on those parameters it will bring the Absolute value of the number to bring it to something meaningful.

How to run a ps1 (works for any PS1 in the Galery):

The first thing you need to know is that scripts can be signed with an external Certificate to run without issues, but I don't use to sign any of my scripts, it's for this reason that you need to modify the computer execution policy of scripts on your testing computer by running in an elevated PowerShell console:
Set-ExecutionPolicy Unrestricted
And pressing "A" or "R" to accept the change. Note for the end of the testing: Change the policy by running the following command prior to close your PowerShell windows:
Set-ExecutionPolicy RemoteSigned
I have uploaded a file with the extension ".dll ". If you wanna know about the C# code behind to this please visit the web page, navigate to the bitbucket URL at the end of the web and download it or clone you'll get the full Visual Studio 2017 Project, you would need VS2017 community (free) and dot net in the latest version 4.7 For details about downloading the script please go to the source. If you want to know about the C# code behind scenes, go to the URL Here's a little video of how to use it:


Post a Comment