#67199 - 2002-06-18 04:12 PM
Re: srnd rnd not random, help guys!
|
BrianTX
Korg Regular
Registered: 2002-04-01
Posts: 895
|
I just ran your script.. It seems to work for me.. let me test some more.
Brian
|
|
Top
|
|
|
|
#67202 - 2002-06-18 04:37 PM
Re: srnd rnd not random, help guys!
|
BrianTX
Korg Regular
Registered: 2002-04-01
Posts: 895
|
Actually, I created a script just for the heck of it to test how well the RND functions.. turns out pretty well. I haven't done a proper statistical analysis, but... this script at least tests that there is convergence when taking the average as the number of rolls approaches infinity.
code:
break on $avg1 = 0 For $g = 1 to 100 SRND(@MSECS) $x = 1000 DIM $Y[$x] $Z = 1 For $n = 0 to $x $j = RND($Z) $Y[$n]=$j Next
$j = 0 For $n = 0 to $x $j = $j + $y[$n] Next
$avg = (CDBL($j)/($x+1)) * 2 $avg1 = $avg1 + $avg Next CDBL($avg1)/100
Brian
|
|
Top
|
|
|
|
#67204 - 2002-06-18 04:47 PM
Re: srnd rnd not random, help guys!
|
BrianTX
Korg Regular
Registered: 2002-04-01
Posts: 895
|
ha ha ha.. nope, not married... not anytime soon, either (at least I hope not!)
Brian
|
|
Top
|
|
|
|
#67206 - 2002-06-18 04:55 PM
Re: srnd rnd not random, help guys!
|
BrianTX
Korg Regular
Registered: 2002-04-01
Posts: 895
|
I don't think SRND returns a value...
Instead of $=SRND(@msecs)
It should be:
SRND(@msecs)
Brian
(although I doubt this will fix the problem.) [ 18 June 2002, 16:57: Message edited by: BrianTX ]
|
|
Top
|
|
|
|
#67207 - 2002-06-18 05:10 PM
Re: srnd rnd not random, help guys!
|
BrianTX
Korg Regular
Registered: 2002-04-01
Posts: 895
|
Ok.. this should work:
code:
$s=45
$b=75
$log=@scriptdir+"\ajat.log"
CLS
"Running Random beep every $s - $b seconds"
? ?"log is being written to $log"
? "to stop the script press any letter"
$b=$b-$s
run '%comspec% /c echo starting time logging at @time >> "$log"'
srnd(@msecs)
do
$sleep=$s+1+rnd($b-1)
play "0g5000f12d128t5g5000f12d128t"
run '%comspec% /c echo @time >> "$log"' at(5,20) @time
sleep $sleep until kbhit()
Brian
|
|
Top
|
|
|
|
#67211 - 2002-06-19 12:31 AM
Re: srnd rnd not random, help guys!
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11634
Loc: Space
|
Slow down and write some better code there Mr. M club.
You ought to be passing me by sometime this week or next at the rate your going.
Oh well, can't stay ahead forever.
|
|
Top
|
|
|
|
#67213 - 2002-06-19 12:41 AM
Re: srnd rnd not random, help guys!
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11634
Loc: Space
|
pfffttt. hmmm... Reminds me of the story of the Tortoise and the Hare.
You run along now sonny boy and do what you need. Eat some of those wild oats if you must. I'll be here waiting when you get back.
|
|
Top
|
|
|
|
#67217 - 2002-06-19 02:44 PM
Re: srnd rnd not random, help guys!
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Jooel,
You may have me and Rad, but work does come first. (ouch!)
Kent
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 837 anonymous users online.
|
|
|