# Code Compliance

Understanding and adhering to these standards is crucial for maintaining the integrity and consistency of your generative art. Here, you'll find detailed instructions on how to:

**Utilize Genify's Random Functions**: Learn how to use Genify's specific random functions for generating numbers, booleans, and choosing elements from a list. This ensures that your artwork remains consistent across different renders with the same hash.

```javascript
//How to use genify random functions

// Generate a random decimal number between 0 and 1
let decimal = R.random_dec();

// Generate a random number between 'a' and 'b'
let num = R.random_num(10, 20); 

// Generate a random integer between 'a' and 'b'
let integer = R.random_int(1, 100); 

// Generate a boolean value based on a probability 'p'
let bool = R.random_bool(0.5); 

// Randomly choose an element from a list
let choice = R.random_choice(["apple", "banana", "cherry"]); 
```

**Signal that rendering is done**

```javascript
R.render_done(); 
```

**Set features for generation**

```javascript
R.set_features({"key1": "value1", "key2": "value2"});
```

**Add Extra CSS Styles**: Instructions on how to incorporate additional CSS styles into your artwork, enhancing its visual appeal without affecting its performance.

```javascript
let gcss = document.getElementById("gcss");
let style = '.myclass { color: red; }';
gcss.innerHTML = gcss.innerHTML + style;
```

**Adapt p5.js Code**: A step-by-step guide on how to modify your p5.js code so that it integrates seamlessly with the Genify platform, ensuring compatibility and performance.\
p5.js\@1.0 or p5.js\@1.6

```javascript
document.addEventListener('p5Loaded', () => {
    function setup() {
        //your original setup code
    }

    function draw() {
        //your original draw code
    }

    window.setup = setup;
    window.draw = draw;
}); 

```

**Use Genify Random Functions in p5.js**: Techniques for incorporating Genify's random functions within your p5.js code, enabling you to maintain consistency in randomness and generate unique yet replicable artwork patterns.

```javascript
function setup() {
    let seed = ~~(R.random_dec() * 123456789);
    randomSeed(seed);
    noiseSeed(seed);
}
```

**Important Tip:**&#x20;

If you encounter a conflict with the variable `R` in your code, you can resolve this by redefining it at the very beginning of your script. For example, you can create a new instance of the random number generator by declaring&#x20;

```javascript
var Rr = new Random();
```

. This allows you to use `Rr` instead of `R` to access Genify's random functions, thus avoiding any potential naming conflicts. This approach ensures that your code runs smoothly on the Genify platform, while maintaining consistency and readability.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://genify-xyz.gitbook.io/docs/generative-inscription/guide-for-artists/code-compliance.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
