This will display random image from specified media library (Backgrounds):
This will display random image from specified media library (Backgrounds) with limited width:
This will display HTML5 Picture element with random image from specified media library (Backgrounds):
{% fileIndex = Math.GetRandomInt(0, SiteObjects.MediaLibraries["Backgrounds"].Files.Count-1);
fileGUID = SiteObjects.MediaLibraries["Backgrounds"].Files[fileIndex].FileGUID;
fileURL = "~/getmedia/" + fileGUID + "/img"; "" %}
This will display image based on GUID (for images stored within Pages) and is code from transformation: