Skip to content

Create array-weight.md #217

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions doc_posts/_commands-array/array-weight.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: "Array Weights"
---
Allows you to weight the chances of the Array Random command.\
Useful for making certain array positions more or less common when returning a random value.

To add weights to an array you must create a second array with the same name +<code>_weight</code> added to its name.

Array positions in the weight array must match the original array to assign the correct weight to those positions.

Setting the weight value to the same number for multiple positions will give those positions an equal chance to be picked <code>value%</code> of the time.\
Setting the weight to 0 will make the chance 0 and it will not be picked in the Array Random command.\
Numbers above 100 are possible but they will heavily weight the randomization towards that value.\
Negative numbers are not possible but decimal numbers are.

{% include example_public.html src="/docs/assets/images/commands-array/arrRand_Ex.png" size="100" title="Getting random array value based on different chances" pastebin="nR5kphiF" %}