Talk:Wish/@comment-2.10.128.52-20181011015648/@comment-2.10.128.52-20181012095012

Looks like I should have found 25% for Rest according to the following code; close enough.

But according to that code, I should *also* see a 50% chance for Time Stop + Alacrity (On a side note I just realised that it's not actually Improved Alacrity, but all casting times reduced to 0). Yet in game, I experience something around 20%.

That means the game doesn't quite work like this page says, or that I misinterpreted.

Here's code meant to reproduce the algorithm, you'll see it outputs 25% for an item in 10th position. Just press SHIFT+F4 on Firefox and paste the code to run it; an alert box will tell you the percentage you *should* get depending on the position of the desired spell in the 18 Wisdom list. It doesn't seem to match reality for Time Stop, but is pretty close for Rest.

(function {  // Change this value if you want to test odds   // for other spells from the 18 Wisdom list  var intRestPosition = 10;

var i, j; var intRoll, intSlots; var intRests = 0; var intRuns = 0; var aWish = new Array(25); var intWishLength = aWish.length; var fRandom = Math.random; for (i = 0; i < 1000000; i++) {   intRoll = 0; intSlots = 5; for (j = 0; j < intWishLength; j++) aWish[j] = 0;

for (j = 0; j < intWishLength; j++) {     intRoll = (fRandom * 2) | 0; aWish[j] += intRoll; intSlots -= intRoll; if (intSlots <= 0) break; }   if (aWish[intRestPosition - 1] === 1) ++intRests; ++intRuns; } alert("Rest chance: " +     String(Math.round(1000 * intRests / intRuns) / 10) +     "%"); });