increased store for random seeds to 64k
This commit is contained in:
1 parent
512a1c4b28
commit
3f372180e6
2 files changed
+7
-6
No files matched your search
@@ -227,11 +227,12 @@ length('foo') => 3
|
||||
### `rand(expr), rand(expr, seed)`
|
||||
|
||||
returns a random number from `0.0` (inclusive) to `expr` (exclusive). In boolean context (in conditions,
|
||||
boolean functions, or `bool`), returns false if the randomly selected value is less than 1\. This means
|
||||
that `rand(2)` returns true half of the time and `rand(5)` returns true for 80% (4/5) of the time. If seed is not
|
||||
provided, uses a random seed. If seed is provided, each consecutive call to rand() will act like 'next' call to the
|
||||
same random object. Scarpet keeps track of up to 1024 custom random number generators, so if you exceed this number
|
||||
(per app), then your random sequence will revert to the beginning.
|
||||
boolean functions, or `bool`), returns false if the randomly selected value is less than 1. This means
|
||||
that `bool(rand(2))` returns true half of the time and `!rand(5)` returns true for 20% (1/5) of the time. If seed is not
|
||||
provided, uses a random seed that's shared across all scarpet apps.
|
||||
If seed is provided, each consecutive call to rand() will act like 'next' call to the
|
||||
same random object. Scarpet keeps track of up to 65536 custom random number generators (custom seeds, per app),
|
||||
so if you exceed this number, your random sequences will revert to the beginning and start over.
|
||||
|
||||
<pre>
|
||||
map(range(10), floor(rand(10))) => [5, 8, 0, 6, 9, 3, 9, 9, 1, 8]
|
||||
|
||||
@@ -37,7 +37,7 @@ public abstract class ScriptHost
|
||||
|
||||
public Random getRandom(long aLong)
|
||||
{
|
||||
if (randomizers.size() > 1024)
|
||||
if (randomizers.size() > 65536)
|
||||
randomizers.clear();
|
||||
return randomizers.computeIfAbsent(aLong, Random::new);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user