Recent Widgets


Register for DashboardWidgets

Recent Forums Posts

Partners


iCompositions

MacDesktops.net

RSS Showcase
RSS Comments
RSS Forums

This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. Posted in: Widget Central

i Need a javascript translator!

Author Message
murph



Joined: 17 Jun 2005
Posts: 5
Location: on my computer in Cali

Posted: Fri Jun 17, 2005 - 1:36 pm    Post subject: i Need a javascript translator! Reply with quote

var ic = 222
function pickRandom(range) {
if (Math.random) {
return Math.round(Math.random() * (range-1));
}
else {
var now = new Date();
return (now.getTime() / 1000) % range;
}
}
var choice = pickRandom(ic);

i needa know what the math is in that thnx

and i need to know how to reduce a divided number to a whole number
EX:
Code:
var number = 100
return (number / 3)

i dont know if thats right but if i divide 100/3 can i make it into a whole number thnks

murph
View user's profile Send private message Send e-mail Visit poster's website AIM Address Widgets
funkdaddy



Joined: 25 Apr 2005
Posts: 35

Posted: Tue Jun 21, 2005 - 10:40 pm    Post subject: Reply with quote

Math.round(number/3);
Math.ceil(number/3);
Math.floor(number/3);

These Math functions all round a number so that it becomes an integer, or whole number. The Math.round(); function will round up or down the number or expression that is inside its brackets to the nearest whole number. The Math.ceil(); function will do the same, however it will always round up to the nearest whole number. The Math.floor(); function is the opposite of the Math.ceil(); , it will always round down to the closest whole number.
View user's profile Send private message Send e-mail Widgets
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.

 
Powered by phpBB © 2001, 2002 phpBB Group