Showing posts with label Entropy. Show all posts
Showing posts with label Entropy. Show all posts

Wednesday, 12 November 2025

Understanding high-entropy random number generation for research: Leymosun Package

Preamble

The idea of generating randomness via computers goes back to von Neumann's and his team of colleagues work in Princeton and Los Alamos. Even though, he was sceptical about the idea of generating randomness via computer programs, this practice is now almost a de-facto standard, so the name pseudo-random-number-generator (PRNG). Is there a way to generate better PRNGs? This is a continuous research. A practical matter of seeding is often ignored because a good PRNG should be reliable regardless of seeding, however, in repeated calls to a random sequence may degrade this view. 

PRNGs bird's eye view : Simulating Randomness

Wigner's Cat (Leymosun Package)
Probably the easiest way to explain RNGs appears to be using discrete recurrence equations, well, actually most RNGs generates numbers based on this, such as $$x_{n+1} = f(x_{n})$$ for example it can be parametrised by $a$ and $b$, $f(x_{n}) = a x_{n} + b$. This basic form allow us remarkably to generate quite useful simulation of randomness. 

Concept of a seed 

An other concept is a seed, it can be the first number to start recurrence but it can also be some other form of something related to random generation, if $x_{0}$ is fixed or has some complicated formula. We usually put seed like 42 or 4242 or some other integer.  There are actually used code with seeds 12345.

Anytime we call a randomisation functions, such as sampling 

How eliminating seeding improves things? High-Entropy Randomness

We use new seeds at each new call, this would generate a different sequence and yields us to sample it. This practice would improve the non-predictability as we sample different sequences. But then the question is, where to get the seeds at each call? The answer lies on the "entropy pool" provided by the operating systems, such us Unix's "/dev/random". Essentially they are kind of random devices we tap into. By using hybrid approach of pseudorandom generation via algorithms and seeding from random devices yields to an increased, High-Entropy randomness. 

Leymosun: Tested implementation

Leymosun Python package provides this facility, using its random module functionality operates as described above and one doesn't need to provide any seeding, it uses non-deterministic seeding. Using NIST's test, we have shown that high-entropy approach gives higher pass scores in randomness tests compare to baseline seeding, such as 42. To install, just use:

 pip install leymosun

Conclusion

Using high-quality randomness for research is quite critical. We have shortly discussed this covering the new approach of using RNGs. 

Further reading and links


Please cite as follows:

@article{suzen21,
  title={Empirical deviations of semicircle law in mixed-matrix ensembles},
  author={S{\"u}zen, Mehmet},
  year={2021},
  journal={HAL-Science},
  url={https://hal.science/hal-03464130/}
}
 @misc{suezen25ley, 
     title = {Understanding high-entropy random number generation for research: Leymosun Package}, 
     howpublished = {\url{https://memosisland.blogspot.com/2025/11/leymosun-high-entropy-randomness.html}}, 
     author = {Mehmet Süzen},
     year = {2025}
}  

Saturday, 14 October 2023

Ising-Conway lattice-games: Understanding increasing entropy

Preamble

The entropy is probably one of the most difficult physical concepts to grasp. Its inception roots in efficiency of engines and foundational connection to multi-particle classical mechanics to thermodynamics,  i.e., kinetic theory to thermo-statistics. However, computing entropy for a physical systems is a difficult task, as most of the real-physical systems lacks the explicit formulation. Apart from advanced simulation techniques that invokes thermodynamical expressions, pedagogically accessible and physically plausible system is lacking in the literature. Addressing this, we explore here, recently proposed Ising-Conway Games.

Figure: Evolution of Ising-Conway
Game  (arXiv:2310.01458)
Ising-Conway Lattice-Games (ICG)

Ising-Lenz model is probably one of the landmark models in physics, remarkably provides beyond its idealised case of magnetic domains,  now impacts even quantum computational research. However, computing entropy of Ising-Lenz models are still quite difficult. On the other hand, Conway introduce a game with simple rules generating complexity in various orders, via simple dynamical rules. By analogy to these two modelling approach,  we recently introduce game like physical system of spins or lattice sides on a finite space with constraints. This gives a physically plausible dynamics but simpler dynamical evolution to generate the trajectories. Because vanilla Ising-Models requires more complicated Monte Carlo techniques.  Here is the configuration and dynamics of Ising-Conway games,

  1. $M$ sites as a fixed space.
  2. $N$ occupied sites, or 1s.  
  3. Configuration $C(M,N,t)=C(i)$ over time changes. But at $t=0$ all occupied sites live in at the corner.
  4. Configuration can only change to neighbouring sites if they are empty. This is closely related to spin-flip dynamics of the Ising Model. 
  5. No sites occupy the same lattice cell, Pauli exclusion
  6. Should be contained within $M$ Cell.
An example evolution is shown on the Figure.

Defining ensemble Entropy on ICG

Now we are in position to define the entropy for ICGs, which easy to grasp conceptually and computationally.  $C(i, t) \in \{1,0\}$ defines the states of  the game. We build an ensemble at a given time $t$ by defining a region enclosed by 1s.  Then dimensionality of the ensemble  $ k(t) = argmax[\mathbb{I}(C(i))] - argmin [\mathbb{I}(C(i)) ]$. Here,  $\mathbb{I}$ returns index of $1$s on the lattice. This ensemble closely track maximum entropy of the system at a given time. 

Conclusions

A new game-like system that helps us to understand entropy increase that has a plausible physical characteristics that one can easily simulate.

Further reading

  • H-theorem do-conjecture, M.Süzen, arXiv:2310.01458
  • Effective ergodicity in single-spin-flip dynamics, Mehmet Süzen. Phys. Rev. E 90, 03214 url
  • do_ensemble module provides such simulation via simulate_single_spin_flip_game  from the repo h-do-conjecture 

Please cite as 

 @misc{suezen23iclg, 
     title = {Ising-Conway lattice-games: Understanding increasing entropy}, 
     howpublished = {\url{https://memosisland.blogspot.com/2023/10/ising-conway-games-entropy-increase.html}}, 
     author = {Mehmet Süzen},
     year = {2023}
}  


(c) Copyright 2008-2024 Mehmet Suzen (suzen at acm dot org)

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License