Rename AsyncRandom and nextPredictable (#3178)

* Rename AsyncRandom and nextPredictable

* Mathematically correct names

* Mention the range is inclusive

* fix typo

* Fix #3180

* Document that nextTriangular follows symmetric trig-dist
This commit is contained in:
apple502j 2022-05-23 21:12:22 +09:00 committed by GitHub
parent 10c797dce2
commit 8bca10d593
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 8 deletions

View File

@ -9,7 +9,7 @@ CLASS net/minecraft/class_5819 net/minecraft/util/math/random/Random
COMMENT {@link java.util.Random}.</li>
COMMENT <li>{@link CheckedRandom}: Throws when used concurrently. Based on
COMMENT {@link java.util.Random}.</li>
COMMENT <li>{@link AsyncRandom}: Blocks the thread when used concurrently. Based on
COMMENT <li>{@link ThreadSafeRandom}: Blocks the thread when used concurrently. Based on
COMMENT {@link java.util.Random}.</li>
COMMENT <li>{@link Xoroshiro128PlusPlusRandom}: Silently breaks when used concurrently.
COMMENT Implements the Xoroshiro128++ algorithm.</li>
@ -35,7 +35,7 @@ CLASS net/minecraft/class_5819 net/minecraft/util/math/random/Random
COMMENT {@return a random with the given {@code seed}} The returned random
COMMENT actively detects concurrent usage and fails on detection.
ARG 0 seed
METHOD method_43050 createAsync ()Lnet/minecraft/class_5819;
METHOD method_43050 createThreadSafe ()Lnet/minecraft/class_5819;
COMMENT {@return a random, suitable for multithreaded scenarios}
COMMENT
COMMENT @deprecated This one is hard to ensure deterministic behavior compared
@ -54,6 +54,11 @@ CLASS net/minecraft/class_5819 net/minecraft/util/math/random/Random
METHOD method_43057 nextFloat ()F
METHOD method_43058 nextDouble ()D
METHOD method_43059 nextGaussian ()D
METHOD method_43385 nextPredictable (DD)D
ARG 1 base
ARG 3 variance
METHOD method_43385 nextTriangular (DD)D
COMMENT {@return a random {@code double} between {@code mode - deviation} and
COMMENT {@code mode + deviation} (both inclusive) with mode {@code mode}}
COMMENT
COMMENT <p>Because the return value follows a symmetric triangular distribution,
COMMENT the distribution's mean and median are equal to {@code mode}.
ARG 1 mode
ARG 3 deviation

View File

@ -1,4 +1,4 @@
CLASS net/minecraft/class_7384 net/minecraft/util/math/random/AsyncRandom
CLASS net/minecraft/class_7384 net/minecraft/util/math/random/ThreadSafeRandom
COMMENT A random that can be shared by multiple threads safely.
FIELD field_38760 INT_BITS I
FIELD field_38761 SEED_MASK J

View File

@ -16,7 +16,7 @@ CLASS net/minecraft/class_6677 net/minecraft/util/math/random/Xoroshiro128PlusPl
COMMENT
COMMENT @implNote In Xoroshiro128++, the lower bits have to be discarded in order
COMMENT to ensure proper randomness. For example, to obtain a double, the upper 53
COMMENT bits, instead of the lower 53 bits.
COMMENT bits should be used instead of the lower 53 bits.
ARG 1 bits
CLASS class_6678 Splitter
FIELD field_35152 MD5_HASHER Lcom/google/common/hash/HashFunction;

View File

@ -17,7 +17,7 @@ CLASS net/minecraft/class_1937 net/minecraft/world/World
FIELD field_35455 tickOrder J
FIELD field_36402 dimensionEntry Lnet/minecraft/class_6880;
FIELD field_38226 neighborUpdater Lnet/minecraft/class_7165;
FIELD field_38861 asyncRandom Lnet/minecraft/class_5819;
FIELD field_38861 threadSafeRandom Lnet/minecraft/class_5819;
FIELD field_9223 border Lnet/minecraft/class_2784;
FIELD field_9226 ambientDarkness I
FIELD field_9229 random Lnet/minecraft/class_5819;