PINE LIBRARY
Mis à jour

random_values

█ OVERVIEW

This library provides helper functions for generating random values of various types, including numbers, letters, words, booleans, and arrays. It simplifies the creation of random data within Pine Script™ for testing, simulations, or other applications.

█ HOW TO USE

Import the library into your script:





Then, use the functions provided:



█ FEATURES

 • num(float min, float max): Returns a random float between *min* and *max*. (Internal helper function, not exported).
 • letter(): Returns a random lowercase letter (a-z).
 • word(int size = 0): Returns a random word. *size* specifies the length (default: random length between 3 and 10).
 • words(int size = 20): Returns a string of random words separated by spaces, where *size* specifies the number of words.
 • boolVal(): Returns a random boolean (true or false).
 • floatVal(float min = 0, float max = 100, int precision = 2): Returns a random float with specified *min*, *max*, and *precision*.
 • intVal(int min = 1, int max = 100): Returns a random integer between *min* and *max*.
 • stringArray(int size = 0): Returns an array of random words. *size* specifies the array length (default: random between 3 and 10).
 • floatArray(int size = 0, float min = 0, float max = 100, int precision = 2): Returns an array of random floats with specified parameters. *size* determines the array length.
 • intArray(int size = 0, int min = 1, int max = 100): Returns an array of random integers with specified parameters. *size* determines the array length.
 • boolArray(int size = 0): Returns an array of random booleans. *size* specifies the array length (default: random between 3 and 10).


█ NOTES

* This library uses the `kaigouthro/into/2` library for type conversions. Make sure it's available.
* Default values are provided for most function parameters, offering flexibility in usage.


█ LICENSE

This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/


```

**Changes and Rationale:**

* **OVERVIEW:** Clearly states the library's purpose.
* **HOW TO USE:** Provides essential import and usage instructions with Pine Script™ examples.
* **FEATURES:** Details each function with its parameters, types, and descriptions. Emphasizes *size*, *min*, *max*, and *precision* as common input parameters using italics. Uses custom bulleted lists.
* **NOTES:** Includes important information about dependencies and defaults.
* **LICENSE:** Directly links to the license URL using the proper `` tag.
* **Formatting:** Uses full block and em space for section titles, consistent bolding, and improved spacing for readability. Removes unnecessary blank lines.

This format improves clarity, making the library documentation easy to understand for TradingView users. Remember to test the rendering on TradingView to catch any formatting issues.


Library "random_values"
A library containing Random value generating helper functions.

letter()
  Random letter generator.
  Returns: (string) A random lowercase letter.

word(size)
  Random word generator.
  Parameters:
    size (int): (int) The desired length of the word. If 0 or not provided, a random length between 3 and 10 is used.
  Returns: (string) A random word.

words(size)
  Random words generator.
  Parameters:
    size (int): (int) The number of words to generate. If 0 or not provided, a random number between 3 and 10 is used.
  Returns: (string) A string of random words separated by spaces.

boolVal()
  Random boolean generator.
  Returns: (bool) A random boolean value (true or false).

floatVal(min, max, precision)
  Random float number generator.
  Parameters:
    min (float): (float) The minimum float value. Defaults to 0.
    max (float): (float) The maximum float value. Defaults to 100.
    precision (int): (int) The number of decimal places. Defaults to 2.
  Returns: (float) A random float number.

intVal(min, max)
  Random integer number generator.
  Parameters:
    min (int): (int) The minimum integer value. Defaults to 1.
    max (int): (int) The maximum integer value. Defaults to 100.
  Returns: (int) A random integer number.

stringArray(size)
  Random string array generator.
  Parameters:
    size (int): (int) The desired size of the array. If 0 or not provided, a random size between 3 and 10 is used.
  Returns: (array<string>) An array of random words.

floatArray(size, min, max, precision)
  Random float array generator.
  Parameters:
    size (int): (int) The desired size of the array. If 0 or not provided, a random size between 3 and 10 is used.
    min (float): (float) The minimum float value. Defaults to 0.
    max (float): (float) The maximum float value. Defaults to 100.
    precision (int): (int) The number of decimal places. Defaults to 2.
  Returns: (array<float>) An array of random float numbers.

intArray(size, min, max)
  Random integer array generator.
  Parameters:
    size (int): (int) The desired size of the array. If 0 or not provided, a random size between 3 and 10 is used.
    min (int): (int) The minimum integer value. Defaults to 1.
    max (int): (int) The maximum integer value. Defaults to 100.
  Returns: (array<int>) An array of random integer numbers.

boolArray(size)
  Random boolean array generator.
  Parameters:
    size (int): (int) The desired size of the array. If 0 or not provided, a random size between 3 and 10 is used.
  Returns: (array<bool>) An array of random boolean values.
Notes de version
v2

Added:
get_color()
  get a random color
description Returns a random color from the colors array.
  Returns: (color) A random color.

get_dayofweek()
  get a random dayofweek
description Returns a random dayofweek value from the dayofweeks array.
  Returns: (int) A random dayofweek value.

get_extend()
  get a random extend
description Returns a random extend value.
  Returns: (string) A random extend value.

get_labelstyle()
  get a random labelstyle(
description Returns a random label style.
  Returns: (string) A random label style.

get_linestyle()
  get a random linestyle
description Returns a random line style.
  Returns: (string) A random line style.

get_location()
  get a random location
description Returns a random location value.
  Returns: (string) A random location value.

get_position()
  get a random position
description Returns a random position value.
  Returns: (string) A random position value.

get_shape()
  get a random shape
description Returns a random shape value.
  Returns: (string) A random shape value.

get_size()
  get a random size
description Returns a random size value.
  Returns: (string) A random size value.

get_textalign()
  get a random textalign
description Returns a random text alignment value.
  Returns: (string) A random text alignment value.

get_fontfamily()
  get a random fontfamily
description Returns a random font family value.
  Returns: (string) A random font family value.

Clause de non-responsabilité