math.randomseed(os.time())
local img = love.image.newImageData(1001, 1001)
local x = 500
local y = 500
img:mapPixel(function()return 255,255,255 end)
local d = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}}
for i=1, 1000000 do
if(x >= 0 and y >= 0 and x < 1001 and y < 1001)then
img:setPixel(x, y, 0, 0, 0)
end
local x2, y2 = unpack(d[math.random(1,4)])
x,y = x + x2, y + y2
end
img:setPixel(500,500,255,0,0)
img:encode("png","out.png")