I used to have a code that did that, but I can't find it anymore. It was a javscript/CSS (either or or both) bundle used through an HTML-file. The only code like it I can find through Google at the moment is that will also change my wallpaper every few minutes, which I assume will drain my battery more than a script that only switches my wallpaper every time I lock my phone.

So, what I want is pretty simple:
1) It must change the wallpaper of my lockscreen every time I lock (or, if it's easier to code, every time I unlock it) it.
2) It must change my wallpaper randomly, as in it'll switch to a randomly chosen wallpaper and not cycle through them in a specific order.