PINE LIBRARY

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.
debugginggeneratorrandom

Pine kitaplığı

Gerçek TradingView ruhuyla, yazar bu Pine kodunu açık kaynaklı bir kütüphane olarak yayınladı, böylece topluluğumuzdaki diğer Pine programcıları onu yeniden kullanabilir. Yazar çok yaşa! Bu kütüphaneyi özel olarak veya diğer açık kaynaklı yayınlarda kullanabilirsiniz, ancak bu kodun bir yayında yeniden kullanılması Ev kuralları tarafından yönetilir.

Feragatname