Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

hma.lua [PART II]

Name: Anonymous 2010-10-07 22:14


hma = math.random(1, 1000)
if hma < 500 then
   print "HAX MY ANUS!"
else
   print "HAX MY ANUS!"
end

Name: sage 2010-10-07 22:15

sage

Name: dump 2010-10-07 22:45

dump

Name: Anonymous 2010-10-08 7:24

the seventh one

Name: Anonymous 2010-10-08 8:51

You bring up an interesting philosophical question. You have a 50% chance of printing "HAX MY ANUS" and a 50% chance of printing "HAX MY ANUS"

Is there any meaning in making a distinction between the two? Together, they add up to 100% and there is no alternate case, but on the other hand, it would be easy to modify either one so there would be an alternate case.

Is there any inherent value in making the distinction?

Name: Anonymous 2010-10-08 11:17

>>5
There is inherent value in not discussing this topic, nor any topic of similarly nonpositive worth.
A sort of ``increased value through lack of worthlessness,'' if you will.

Name: Anonymous 2010-10-08 16:42

>>5
print "HAX MY ANUS"

EXPERT SOLUTION

Name: Anonymous 2010-10-16 17:54

hax my anus

Name: Anonymous 2010-10-16 17:59

>>5
It's not actually 50/50. The odds of taking the first branch are 500/999, or 50.05% and a bit.

Name: Anonymous 2010-10-17 2:29

>>9
moar like 499/1000
because op said < not <=

Name: Anonymous 2010-10-17 13:48

>>9 is probably more comfortable with languages like Python, where ranges are half-inclusive (e.g. Python's range(1, 5) returns [1, 2, 3, 4] and notably not 5). Lua isn't one of these languages, so >>1's code will return 1000 values, and not 999 as >>9 seems to expect. As for the actual range and odds of each branch, the split is between values 1...499 and 500...1000, which are respectively 499 and 501 elements. Therefore, the two branches have (assuming a completely fair random algorithm) 49.9% and 50.1% execution probability.

Name: Anonymous 2010-10-17 17:47

>>11
Maybe you should actually read the documentation. Lua's two-argument math.random is half-inclusive.

Name: Anonymous 2010-10-17 17:57

>>12
> t = {}; for n = 1, 1000 do table.insert(t, math.random(1, 3)) end; table.sort(t); table.sort(t); print(table.concat(t, ''))
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333


So where the fuck did all those 3's come from, if it's half-inclusive?

Name: Anonymous 2010-10-17 19:24

Retrospectively, concatenating with spaces would have been more sensible.

Name: Anonymous 2010-11-15 22:03

Don't change these.
Name: Email:
Entire Thread Thread List