
Joined: Sep 2005
Posts: 44
Ameglian cow

OP
Ameglian cow
Joined: Sep 2005
Posts: 44 
If i was to write 100 sentences in a notepad and saved as.txt is it possible for me to make a button that can change its name randomly every time i click it, and when i click it, the text that matches that button writes in chat? like it knows what line its looking for?
Reece.




Joined: Apr 2003
Posts: 701
Hoopy frood

Hoopy frood
Joined: Apr 2003
Posts: 701 
I don't know if it's possible for you, but it's most certainly possible in mIRC.
Make a dialog with a button, have the dialog read a random line from text into a %var on load, use that %var is button text, have the button click event msg that %var to channel and read a new random line ito it and update the button display.




Joined: Sep 2003
Posts: 4,230
Hoopy frood

Hoopy frood
Joined: Sep 2003
Posts: 4,230 
I don't know if it's possible for you lol you meany!




Joined: Dec 2002
Posts: 1,245
Hoopy frood

Hoopy frood
Joined: Dec 2002
Posts: 1,245 
but is it possible for mIRC to know if he wants the text randomly selected, or in order?




Joined: Dec 2002
Posts: 2,985
Hoopy frood

Hoopy frood
Joined: Dec 2002
Posts: 2,985 
Install the .TXT file in the root mIRC folder and then insert the following on a new line in your popups file:
Random Sentence:echo ta $read($mircdir\filename.txt)
This will display a random sentence from your sentences file.
Mikechat: Random means random, not in order. :tongue:




Joined: Sep 2003
Posts: 4,230
Hoopy frood

Hoopy frood
Joined: Sep 2003
Posts: 4,230 
Random means random, not in order. But could not if it is totally random, there be an occasion when it occured in order?




Joined: Aug 2004
Posts: 7,252
Hoopy frood

Hoopy frood
Joined: Aug 2004
Posts: 7,252 
The odds of a random selection occurring in sequential order decrease relative to the number of possible items to choose from.
If you only have two items, then there's a 50/50 chance that a random selection will match a sequential selection.
If you have 3 items, then it's a 33% chance
A basic formula would be 100/ (number of items) %
The actual formula is quite a bit more complex, and I've got it someplace, just not sure where right now.




Joined: Dec 2002
Posts: 1,245
Hoopy frood

Hoopy frood
Joined: Dec 2002
Posts: 1,245 
so then you are saying that a randomly played list, through whatever strange chance of fate brought out in the caos of nature, could indeed be in actual order, however rare the chance might be?




Joined: Aug 2004
Posts: 7,252
Hoopy frood

Hoopy frood
Joined: Aug 2004
Posts: 7,252 
Yes, this could occur, however, the odds of it occuring diminish quickly the more items you have Here's a little script I did up to get the numbers accurately (or at least as accurately as mIRC will display them) in a percentage form alias comb {
set %a $iif($1,$1,$$?"Number of items")
set %c 1
while (%a) {
set %c $calc(%c * %a)
dec %a
}
echo a $calc(100 / %c) $+ %
}
Note the above code presumes that only 1 item is being picked at a time.
Last edited by RusselB; 26/09/05 05:49 AM.




Joined: Dec 2002
Posts: 1,245
Hoopy frood

Hoopy frood
Joined: Dec 2002
Posts: 1,245 
so, the highest that returned a result greater than 0 was with only 11 items in the list where the script returned 0.000003% or roughly 1 chance in 33,333,340 if I am right the number of permutations is something like //echo s $calc(11 * 10 * 9 * 8 * 7 * 6 * 5 * 4 * 3 * 2 * 1) = 39916800 roughly 1 in 40,000,000 so if I have say a list of 571 songs, while the odds are mathematically low, it Could play them in order, randomly....... and with caos, it might only take one attempt? some math odds {
var %number = $$1
var %reps = %number  1
var %i = 1
var %math = %number
while (%reps) {
var %math = %math $!chr(42) $calc(%number  %i)
inc %i
dec %reps
}
echo s $+($,calc) $+ ( $(%math,2) ) = $calc($(%math,2))
}
(largest number I could get a result on was 79)




Joined: Oct 2004
Posts: 8,330
Hoopy frood

Hoopy frood
Joined: Oct 2004
Posts: 8,330 
Yes, you always have a chance on the first attempt to have that happen, albeit a very small chance. It makes me think of the question of the chance to flip a coin and get either head or tails... If you ignore the weight difference that does affect the actual chance of getting heads or tails, and you flip the coin 9 times, and you have flipped 5 heads and 4 tails, what's the chance of getting tails the next flip? Sometimes people think too hard and try to figure out how many flips were done and so on, when the answer is 50% no matter how many flips are done. If you managed to flip 100 tails in a row, the chance of the next flip being tails again is 50% ... the odds never change when considering a single flip. Only when considering many flips at a time, do the odds change. Just made me think of that.
Invision Support #Invision on irc.irchighway.net




Joined: Dec 2002
Posts: 1,245
Hoopy frood

Hoopy frood
Joined: Dec 2002
Posts: 1,245 
what that doesn't take into account are the chances that it will land on edge erf I see I named that alias "odds" and it should be "permutations" oh well not like it really matters.......




Joined: Oct 2004
Posts: 8,330
Hoopy frood

Hoopy frood
Joined: Oct 2004
Posts: 8,330 
Heh... what *are* the odds of that happening, anyhow? I've never had that happen to me.
Invision Support #Invision on irc.irchighway.net




Joined: Sep 2003
Posts: 4,230
Hoopy frood

Hoopy frood
Joined: Sep 2003
Posts: 4,230 
I only have two things to say. [One] Think about this, randomly order the set of numbers 0 to 9
The chance of this "2,6,5,9,1,4,0,7,3,8" random order appearing is 1 in 3628800 and This is not a random order "0,1,2,3,4,5,6,7,8,9" its chance of appearing is also 1 in 3628800
The chance of getting an ordered responce is as likely as any other abitary random order. (please read carefiully before telling me im wrong)
[two] I disagree with weighted sides of a real world coin.
The differing "weight" of the sides of a coin well not effect the randomality of the side it lands on, becuase this, the fact is a coins differing face weights are so small all that happens is there is a minute off setting from center of the coins center of gravity (center point of the spinning coin), so infact there is no weight difference, also the fact that the coin impacts to the surface its landing on while still spinning, (a spin that doesnt slow down for one "heavier side" and speedup for a "lighter side") means the randomality of what side it lands on is still 50%. PS : Im ignoring all chaos elements such as air resistence/magnetic/orbital/physic/god invulencing the outcome




Joined: Jul 2003
Posts: 655
Fjord artisan

Fjord artisan
Joined: Jul 2003
Posts: 655 
The odds of that depend very heavily on the environment in which the coin was flipped, the speed at which it was flipped, the height at which it was flipped at and so on. eg if you slip the coin very slow low to the ground the chance it will land on the edge is much greater than if you flipped it quickly and from a greater height.
As for randomality, nothing is ever random. As soon as you try to do something at random (such are the numbers example above), you are infact subconciously placing them in such a way that seems the least orderly. eg you will subconciously or conciously not put 1 2 and 3 in sequence, therefor you are infact not picking at random. While the mathematical chances of placing the numbers 0 through 9 in order are infact the same as placing them in any other 'seemingly random' order (such as 4 7 5 0 9 6 2 8 1 3). The theoretical chances that your outcome will be 4 7 5 0 9 6 2 8 1 3 are infact much greater than 0 1 2 3 4 5 6 7 8 9. Because your mind will specifically try to avoid such obvious orders.
This is the same for almost all 'random' number generators (such as $rand in mirc). Due to the simple fact that they are designed on some level to avoid obvious orders. Since the chances of each combination is not equal, this perhaps ironically means that an ordered outcome from a random number generator is infact more random than an unordered outcome.
Anyway, i probably rambled a little, but for the other math/physics enthusiests this is explained to some degree by both Chaos Theory and Quantum Chaos Theory.
"Allen is having a small problem and needs help adjusting his attitude"  Flutterby




Joined: Dec 2002
Posts: 2,985
Hoopy frood

Hoopy frood
Joined: Dec 2002
Posts: 2,985 
For the record, yes it is mathematically possible however you'd probably have a better chance of being hit by lightning.




Joined: Oct 2004
Posts: 8,330
Hoopy frood

Hoopy frood
Joined: Oct 2004
Posts: 8,330 
DaveC, although I haven't tried it, I've seen some test results for flipping a coin, where the difference is something like 50.5% tails and 49.5% heads after thousands of flips. **I'm guessing on the percents because I haven't looked at the report data in years, though I do remember tails being just slightly higher**
Om3n, I disagree about $rand in mIRC trying to avoid exact orders. Why? Because mIRC doesn't automatically try to do a sequence randomly. You either do a large number randomly [$rand(1,123434543345)], which would do any random number and would therefore not be trying to avoid correctly sequenced numbers. Or, you do each number individually [$rand(1,9) $+ $rand(1,9) $+ $rand(1,9) $+ $rand(1,9)], which does each number randomly using the same algorithms and not comparing it to previous $rand results, therefore it also wouldn't try to avoid sequenced numbers. Many random number generators are based on clock ticks which can make it less likely for results to be in sequence, but that's nothing to do with mIRC trying to prevent such a sequence.
Invision Support #Invision on irc.irchighway.net




Joined: Jul 2003
Posts: 655
Fjord artisan

Fjord artisan
Joined: Jul 2003
Posts: 655 
Indeed you are correct, i forgot mirc will only give a single number at a time.
"Allen is having a small problem and needs help adjusting his attitude"  Flutterby




