Skip to content

Commit 562a109

Browse files
committed
feat: Add Ellipsis version of ChooseOne function
1 parent 549d588 commit 562a109

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

Assets/JCSUnity/Scripts/Util/JCS_Random.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,5 +95,10 @@ public static T ChooseOne<T>(List<T> inList)
9595
int index = Range(0, inList.Count);
9696
return inList[index];
9797
}
98+
public static T ChooseOneE<T>(params T[] args) // Ellipsis
99+
{
100+
int index = Range(0, args.Length);
101+
return args[index];
102+
}
98103
}
99104
}

docs/ScriptReference/Util/JCS_Random.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ Random library class.
44

55
## Functions
66

7-
| Name | Description |
8-
|:-------------|:---------------------------------|
9-
| Range | Default random range wrapper. |
10-
| RaneeInclude | Include the maxinum number. |
11-
| RandomColor | Returns a random color. |
12-
| ChooseOne | Choose one object from the list. |
7+
| Name | Description |
8+
|:-------------|:--------------------------------------------|
9+
| Range | Default random range wrapper. |
10+
| RaneeInclude | Include the maxinum number. |
11+
| RandomColor | Returns a random color. |
12+
| ChooseOne | Choose one object from the list. |
13+
| ChooseOneE | Choose one object from the list. (Ellipsis) |

0 commit comments

Comments
 (0)