// If player has rejected a trumble offer, reset trumble mission with 2% probability per jump.
if (missionVariables.trumbles === "NOT_NOW" && Math.random < 0.02)
// If player has rejected a trumble offer, reset trumble mission with 2% probability per jump.
if (missionVariables.trumbles === "NOT_NOW" && Math.random < 0.02)
I was just searching the BBS for Math.random (trying to figure out if it's truly random like I thought, or if it repeats reliably in given situations, as some recent reports about my OXP have suggested) and stumbled across this thread. Shouldn't that be "Math.random()", as in calling the method, not testing the value of the method pointer? Or is there other magic at work here that I'm not understanding?
(Of course Math.random isn't "truly random" any more than any other algorithmic pseudo-random number generator is, viz von Neumann's "state of sin". But in oolite, "pseudo-random" has come to mean that the generator's seed gets reset to the same value for, what, a given system? As in the System.pseudoRandomNumber method. Which is quite handy in some circumstances, but not in my particular case.)
I was just searching the BBS for Math.random (trying to figure out if it's truly random like I thought, or if it repeats reliably in given situations, as some recent reports about my OXP have suggested) and stumbled across this thread. Shouldn't that be "Math.random()", as in calling the method, not testing the value of the method pointer? Or is there other magic at work here that I'm not understanding?
Good catch. You understand correct. Math.random < 0.2 will always stay false. I looked back and this has been wrong since the beginning. At least it was already wrong in Oolite 1.70, the first JS translation of this script. Result: only one offer and than it stops since than. And nobody complained about that
heheh.
Even though I used the trumblescript as a template for trumble treats, the confusion I got in with the salted pseudorandomnumbers resulted in a corrected code.
Shouldn't that be "Math.random()", as in calling the method, not testing the value of the method pointer?
Good catch. You understand correct. Math.random < 0.2 will always stay false. I looked back and this has been wrong since the beginning. At least it was already wrong in Oolite 1.70, the first JS translation of this script.
Another win for open source!
Eric Walch wrote:
Result: only one offer and than it stops since than. And nobody complained about that
Hey, don't look at me! Even if I had known about it before, I sure wouldn't have complained!
The problem is sun broiled slaves only sell when marketed as imitation edible poet.
And the dead poet society takes a dim view on misuse of their product.
"One tonne of slaves perished from the heat: gain a tonne of food"
"The heat makes you thirsty: you break the seals on a container of cooled Aesian water. -1 tn liquors"
"Sensitive components in a container of hyper Amstrad computers, render them useless. -1t C, +1t alloys."
"You can now sell your food as radioactives."
etc.
Hard vacuum and even typical space radiation won't make a cargo canister warm. It'll probably instead leave nitrogen pooling as a liquid.
But if you're cooking trumbles in your cabin then chances are the cargo bay is at least as hot as that. Food even in a cargo canister may be slowly overcooked.