> For the complete documentation index, see [llms.txt](https://trizen.gitbook.io/sidef-lang/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://trizen.gitbook.io/sidef-lang/programming_tasks/p/pseudorandom_number_generator_image.md).

# Pseudorandom number generator image

```ruby
require('GD')

var img = %O<GD::Image>.new(500, 500, 1)

for y in (0..500), x in (0..500) {
    var color = img.colorAllocate(255.irand, 255.irand, 255.irand)
    img.setPixel(x, y, color)
}

File("image500.png").write(img.png, :raw)
```
