> For the complete documentation index, see [llms.txt](https://docs.brightmoments.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.brightmoments.io/artist-collaborations/artist-docs-and-onboarding/flex-engine/random-image-generator.md).

# Random Image Generator

The "Random Image Generator" can be used in case that there is a batch of pre-rendered images.&#x20;

The script is specific for the Artblocks Flex Engine and pulls images down from an folder hosted IPFS by Brightmoments.

* The artist must provide images uploaded via google drive
* The images are then hosted on IPFS via the Brightmoments Pinata account
* Once images are hosted, The following snippet code can be added onto the AB test/mainnet: \
  <https://gist.github.com/Spongenuity/7e24e5ec994c3fadfff68f484274ab4e>
  * This code is written using p5.js, so please ensure that this has been set in the AB config.
  * On the snippet, CID must be replaced with the CID of the hosted folder
  * Please ensure that the variable `totalImages` is the correct edition size
  * Please also ensure that `tokenId` is removed from line 30 and that&#x20;

    ```javascript
    selectImage(tokenId)
    ```

    &#x20;is replaced with

    ```javascript
    selectImage(tokenData.tokenId)
    ```

    &#x20;as per the comments on the snippet
