Pseudorandom number generator image: Difference between revisions

From Rosetta Code
Content added Content deleted
(Improved spacing, issue with image file)
Line 18: Line 18:
*   Linear congruential generator [https://en.wikipedia.org/wiki/Linear_congruential_generator].
*   Linear congruential generator [https://en.wikipedia.org/wiki/Linear_congruential_generator].
<br><br>
<br><br>


=={{header|Julia}}==
Julia uses the Mersenne Twister algorithm for its default rand() function. That algorithm uses
over 600 32-bit ints to represent its internal state, rather than just a product of
two or three primes.
<lang julia>using FileIO, ImageIO

save("randombw.png", rand(Float16, 1000, 1000))
</lang>

Revision as of 17:52, 27 July 2020

Pseudorandom number generator image is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.
Task

Write a program that creates an image from an Pseudorandom Number Generator(PRNG) algorithm's output. The image can have the following dimensions:

  1. 250px by 250px : If the algorithm requires the use of prime numbers, use 8-15 bit primes.
  2. 500px by 500px : If the algorithm requires the use of prime numbers, use 8-15 bit primes.
  3. 1000px by 1000px : If the algorithm requires the use of prime numbers, use 8-32 bit primes.
  4. 1500px by 1500px : If the algorithm requires the use of prime numbers, use 16-64 bit primes.
Possible Output
File:PsuedoRandomAlgorithm.png







See also
  •   Blum Blum Shub [1].
  •   Blum-Micali Algorithm: [2].
  •   Linear congruential generator [3].




Julia

Julia uses the Mersenne Twister algorithm for its default rand() function. That algorithm uses over 600 32-bit ints to represent its internal state, rather than just a product of two or three primes. <lang julia>using FileIO, ImageIO

save("randombw.png", rand(Float16, 1000, 1000)) </lang>