Jump to content

Pseudorandom number generator image: Difference between revisions

→‎{{header|Wren}}: Updated preamble and changed to Wren S/H
imported>Maxima enthusiast
No edit summary
(→‎{{header|Wren}}: Updated preamble and changed to Wren S/H)
 
(One intermediate revision by one other user not shown)
Line 564:
(prin (if (rand T) 1 0)) )
(prinl) ) )</syntaxhighlight>
=={{header|Python}}==
'''Libraries:''' [https://pypi.org/project/Pillow/ Pillow], [https://docs.python.org/3/library/random.html random]<syntaxhighlight lang="python3">
# pseudorandom number image generator by Xing216
from random import randbytes
from PIL import Image
 
size = 1500
x = bytes.fromhex(" ".join([randbytes(3).hex() for x in range(size*size)]))
img = Image.frombuffer('RGB', (size, size), x, 'raw', 'RGB', 0, 1)
img.show()
</syntaxhighlight>'''Output:''' [https://transfer.sh/tyN5SS95M0/rcXing216.png rcXing216.png] (transfer.sh)
 
=={{header|Raku}}==
Line 606 ⟶ 617:
=={{header|Wren}}==
{{libheader|DOME}}
WrenDOME's 'random' module uses thea '[https://en.wikipedia.org/wiki/Well_equidistributed_long-period_linearpseudorandom Wellnumber equidistributedgenerator long-periodbased on the linear]'''Squirrel3''' (WELL512aoptionally '''Squirrel5''') PRNGnoise function which doesn't need to be seeded with a prime number. It is in fact seeded from a sequence of 16 numbers but, if less are provided, the others are generated automatically. Typically (as here) the seed is generated from the current system time.
<syntaxhighlight lang="ecmascriptwren">import "dome" for Window
import "graphics" for Canvas, Color
import "random" for Random
9,486

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.