DoctorD90 icon

RRand.tcl 3.2.0

DoctorD90 | PRO | 06/07/12 09:46:03 AM UTC | 0 ⭐ | 223 👁️ | Never ⏰ | []
TCL |

950 B

|

None

|

0 👍

/

0 👎

### RRand.tcl 3.2.0 pQFrdM8L
 
#REQUIREMENTS
# PBinScr.tcl fMrtKqyq
 
#LICENSE
#Distribuited under License ___
 
#PATERNITY
#Coder: DoctorD90
#Network: irc.OnlineGamesNet.net
#Chan: #eHito
#Mail: [email protected]
#
#Thanks to guys on #egghelp on irc.freenode.net
 
#PURPOSE
# With this proc, it'll be simplier randomize
#a number in an interval between 2 of them
# of your choice.
 
#USAGE
#set var [rrand a b]
#  a  InferiorLimit
#  b  SuperiorLimit
 
 
### DON'T EDIT ANYTHING BELOW ###
 
proc rrand {inf sup} {
  if {![string is integer -strict $inf]} {
    error "Inferior Limit is not a number"
  }
  if {![string is integer -strict $sup]} {
    error "Superior Limit is not a number"
  }
  if {$inf == $sup} {
    return $inf
  }
  if {$inf > $sup} {
    set infb $inf
    set inf $sup
    set sup $infb
  }
  set gap [expr {$sup - $inf + 1}]
  return [expr {int(rand()*${gap})+${inf}}]
}
 
putlog "RRand.tcl LOADED"

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎