Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Coin toss??

Faminu Sojourner
Buttons aren't toys
Join date: 1 Oct 2004
Posts: 138
12-08-2004 13:27
Has anyone ever seen a Coin Toss script? Just a basic heads/tails that is truly random (well as random as a coin toss can be).
Elle Pollack
Takes internets seriously
Join date: 12 Oct 2004
Posts: 796
12-08-2004 14:59
Check out the Linden scripted dice in the library section of your inventory: they're physics based, you can throw them and the script is already full perms. That might give you a good starting point.
Lex Neva
wears dorky glasses
Join date: 27 Nov 2004
Posts: 1,361
12-08-2004 15:55
From: someone
Has anyone ever seen a Coin Toss script? Just a basic heads/tails that is truly random (well as random as a coin toss can be).


Note here that copmputers really can't do "truly" random. In fact, nothing is truly random, except perhaps quantum phenomena, but one could say we simply don't understand them well enough. Anyway, I guess your options here are to use the llFrand() function, but this is only "pseudorandom", using a chaos function that is proven to be mathematically not much different from the theoretical "truly random" function. That, or you could do what was suggested, and rely on collisions and inaccuracies in the physics engine to choose heads vs. tails by simply setting the object physical and dropping it... not sure what results you'll get here, but it might well not be as random as a coin tossed in the real world. Experiment.
DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
12-08-2004 18:26
CODE

default {
touch_start(integer num_detected) {
float coinToss = llFrand(1);
if(coinToss < 0.5) llSay(0, "Tails!");
if(coinToss > 0.5) llSay(0, "Heads!);
if(coinToss = 0.5) llSay(0, "Coin landed on edge, try again.");
}
}
Punklord Drago
Registered User
Join date: 8 Sep 2004
Posts: 22
12-09-2004 06:24
i got this giant coin u click on and it flips it self, i found it in the box one day so if you IM me i will gladly give u a copy!!!
Faminu Sojourner
Buttons aren't toys
Join date: 1 Oct 2004
Posts: 138
12-09-2004 07:16
hehe thanks, not looking for the coin.

Was just curious to see if there was a successfull coin toss(er).

Thanks all ;)
Samhain Broom
Registered User
Join date: 1 Aug 2004
Posts: 298
12-09-2004 07:53
From: Lex Neva
Note here that copmputers really can't do "truly" random. In fact, nothing is truly random, except perhaps quantum phenomena, but one could say we simply don't understand them well enough. Anyway, I guess your options here are to use the llFrand() function, but this is only "pseudorandom", using a chaos function that is proven to be mathematically not much different from the theoretical "truly random" function. That, or you could do what was suggested, and rely on collisions and inaccuracies in the physics engine to choose heads vs. tails by simply setting the object physical and dropping it... not sure what results you'll get here, but it might well not be as random as a coin tossed in the real world. Experiment.


(*spoken lightly and with a sense of humor intended*)I think it would be random enough that you could not accurately guess each time what the result would be. Or, let's say that if you guess each time the coin was tossed, your accuracy would then truely be one level higher towards randomness! =)
_____________________
rm -rf /bin/ladden #beware of geeks bearing grifts
Aaron Levy
Medicated Lately?
Join date: 3 Jun 2004
Posts: 2,147
01-24-2005 20:30
From: Elle Pollack
Check out the Linden scripted dice in the library section of your inventory: they're physics based, you can throw them and the script is already full perms. That might give you a good starting point.


I don't have scripted dice in the library section of my inventory. :( Can someone send it to me, I was just looking for one. Thanks!