Pseudorandom number generator image: Difference between revisions
Content added Content deleted
MaiconSoft (talk | contribs) (Added Delphi example) |
|||
Line 301: | Line 301: | ||
save("randombw.png", rand(Float16, 1000, 1000)) |
save("randombw.png", rand(Float16, 1000, 1000)) |
||
</lang> |
</lang> |
||
=={{header|Nim}}== |
|||
Nim standard PRNG is an implementation of the <code>xoroshiro128+</code> (xor/rotate/shift/rotate) algorithm which is extremely fast. The standard library provides a Mersenne Twister implementation too. For this task, we used the first one. |
|||
<lang Nim>import random |
|||
import imageman |
|||
const Size = 500 |
|||
randomize() |
|||
var image = initImage[ColorRGBU](Size, Size) |
|||
for x in 0..<Size: |
|||
for y in 0..<Size: |
|||
let color = ColorRGBU([rand(255).byte, rand(255).byte, rand(255).byte]) |
|||
image[x, y] = color |
|||
image.savePNG("prng_image.png", compression = 9)</lang> |
|||
=={{header|Perl}}== |
=={{header|Perl}}== |