• x-e.ro
  • whois
  • blog
  • code
  • vids
  • lab
  • fonts
  • etc

actionscript3 randomizer

code :: one line function

here a nice little one liner. this function returns a random number between a user supplied range.

function randomizer (low:Number, high:Number):Number {
   return Math.floor(low + (Math.random() * (high-low)));
}

example useage, will return a number between 5 - 50.

var x:Number = randomizer(5, 50);
03
Jul
2007
posted in: code / actionscript, random / math.random()
tagged: code, actionscript, flash, flex, random

tags

  • 1337
  • 806
  • 8bit
  • actionscript
  • ansi
  • ascii
  • asp.net
  • BBS
  • blog
  • c#
  • cgi
  • code
  • css
  • database
  • demo
  • downloads
  • drunken
  • flash
  • flex
  • fonts
  • friends
  • games
  • git
  • graffiti
  • h4x
  • javascript
  • linux
  • linx
  • LSDj
  • modz
  • movies
  • mxml
  • nintendo
  • open source
  • papervision3d
  • party
  • perl
  • photos
  • photoshop
  • php
  • poetry
  • quotes
  • rain
  • random
  • rant
  • rawk
  • recipe
  • shell
  • shows
  • SQL
  • tech
  • tutorial
  • vacation
  • wii
  • winter
  • work

categories

code
  • actionscript
  • c#
  • sql
  • php
  • perl
  • html/css
  • javascript
  • shell
art
  • fonts
  • abstract
  • pixel
  • ascii
  • graffiti
notes
  • misc
lab
  • demos
  • interactive
  • linux
  • mobile
  • h4x
  • #netart
entertainment
  • games
  • audio
  • video
random
  • math.random()
  • life
  • quotes
uncategorized

feeds

  • newest posts
  • more feeds
  • newest posts
  • more feeds
 2023  xero harrison
metroid-larva metroid