Random again
This WebDNA talk-list message is from 2003
It keeps the original formatting.
numero = 47438
interpreted = N
texte = A while ago there was some discussion about using [math]ceil([RANDOMformat=float]*(randomrange))[/math] to get a random number. We were justtrying this and came up with an anomaly: including the occasional negativenumber!!! (and the negative number always is in the range -480 to -490ish.Here's our code. It looks for a RANDOM no up to 99 over 50,000 loops, andcounts the number of occurences of 1, numbers in the 90s, 0, and less thanzero.[math show=f]one_count=0[/math][math show=f]ninety_count=0[/math][math show=f]zero_count=0[/math][math show=f]minuszero_count=0[/math][loop start=1&end=50000&advance=1][text show=f]random_number=[math]ceil([RANDOMformat=float]*(99))[/math][/text][!][showif [random_number]<1][index]. [random_number]
[/showif][/!][showif [random_number]=1][mathshow=f]one_count=[one_count]+1[/math][/showif][showif [random_number]>90][mathshow=f]ninety_count=[ninety_count]+1[/math][/showif][showif [random_number]=0][mathshow=f]zero_count=[zero_count]+1[/math][/showif][showif [random_number]<0][mathshow=f]minuszero_count=[minuszero_count]+1[/math][/showif][/loop]one_count: [one_count]
ninety_count: [ninety_count]
zero_count: [zero_count]
minuszero_count: [minuszero_count]Regards,Tim-- Tim RobinsonIDFK Web Developmentstim@idfk.com.au114a/40 Yeo StreetNeutral Bay 2089AustraliaPhone +612 9908 2134Fax +612 9908 4837-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list
.To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/
Associated Messages, from the most recent to the oldest:
A while ago there was some discussion about using [math]ceil([RANDOMformat=float]*(randomrange))[/math] to get a random number. We were justtrying this and came up with an anomaly: including the occasional negativenumber!!! (and the negative number always is in the range -480 to -490ish.Here's our code. It looks for a RANDOM no up to 99 over 50,000 loops, andcounts the number of occurences of 1, numbers in the 90s, 0, and less thanzero.[math show=f]one_count=0[/math][math show=f]ninety_count=0[/math][math show=f]zero_count=0[/math][math show=f]minuszero_count=0[/math][loop start=1&end=50000&advance=1][text show=f]random_number=[math]ceil([RANDOMformat=float]*(99))[/math][/text][!][showif [random_number]<1][index]. [random_number]
[/showif][/!][showif [random_number]=1][mathshow=f]one_count=[one_count]+1[/math][/showif][showif [random_number]>90][mathshow=f]ninety_count=[ninety_count]+1[/math][/showif][showif [random_number]=0][mathshow=f]zero_count=[zero_count]+1[/math][/showif][showif [random_number]<0][mathshow=f]minuszero_count=[minuszero_count]+1[/math][/showif][/loop]one_count: [one_count]
ninety_count: [ninety_count]
zero_count: [zero_count]
minuszero_count: [minuszero_count]Regards,Tim-- Tim RobinsonIDFK Web Developmentstim@idfk.com.au114a/40 Yeo StreetNeutral Bay 2089AustraliaPhone +612 9908 2134Fax +612 9908 4837-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/
Tim Robinson
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
&max= (2003)
WebCat2: multiple currency support (1997)
[WebDNA] [raw] tag with [interpret] question (2010)
[WebDNA] User Management System [Cookie] (2008)
Many are called but only 6 make it to founditems. (2001)
WC Database Format (1997)
Stability complaints (2002)
how to do [search] params on the fly? (2004)
verify online (1997)
wierd [cart] action! (1997)
HomePage Caution (1997)
RAM problems, [appendfile] problems (1998)
Progress !! WAS: Trouble with formula.db (1997)
Security Question (1997)
fresh eyes needed. Append won't work. (2000)
Sorting (1998)
There's a bug in the math context ... (1997)
WebCatb15 Mac CGI -- [purchase] (1997)
Fun with Dates - finally resolved but.... (1997)
New Command prefs ... (1997)