Skip to content

Commit 4f236a6

Browse files
committed
Explain randomize better
1 parent 70a45ae commit 4f236a6

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

RandomTips.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ async function shouldBeShown(tipSpec, thisTipConfig, tipSpecOrig) {
224224
if (moduleConfig.triggeredOpen < tipSpec.requiredTriggers) {
225225
return false;
226226
}
227-
// 1 : x -> if one number is not selected, do not display result
227+
// only show result in x% of cases (uses float points < 1 for percentage)
228228
if (tipSpec.randomizeDisplay && !randomizePassed(tipSpec.randomizeDisplay)) {
229229
return false;
230230
}

examples/Tips.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232
* given number of times. See {@link RandomTips.setContext}.
3333
* @property {bool|integer} [randomizeDisplay=false] Randomizes the display with a
3434
* chance of 50% by default (when set to `true`). You can override that percentage
35-
* (as an integer, e.g. 0.2 instead of 20%).
35+
* by specifying an integer < 1 (e.g. 0.2 for a 20% chance) as a propbability.
36+
* The chance is the chance that the tip *is shown*, i.e. the tip is shown for
37+
* <= p and not shown for < p if p is the propbability you pass.
3638
* Note that the tip message display in general is already randomized
3739
* with a chance of 20%, see {@link RandomTips.GLOBAL_RANDOMIZE}.
3840
* @property {string} text The text to actually show. It is passed to the

0 commit comments

Comments
 (0)