没有方向,不叫发展

又到了年末,总结、规划少不了。

简单点,8个字:

没有方向,不叫发展


运行示例:

从 20 岁到 40 岁,

集中度为 0.8,
增值达到 10.9倍,
最高 46.0
最低 0.10



// 没有方向,不叫发展 2014-1-26 10:24:19
// No Directions, No Development. 2014-1-26 10:25:22
var amount = 1;
var focus = 1;
var ageBegin = 20;
// var ageEnd = 35;
var ageEnd = 40;
var age = 20;
var focusPercentage = 0;
var increasePercentage = 1.2;
var decreasePercentage = 0.9;
var focusNum = 0;
var amountTop = 1;
var amountBottom = 1;
// Calculating:
age = ageBegin;
while(age <= ageEnd){
    focus = getRandFocus();
    if(focus){
        focusNum++;
        amount = amount*increasePercentage;
    }else{
        amount = amount*decreasePercentage;
    }
    amountTop *= increasePercentage;
    amountBottom *= decreasePercentage;
    age++;
}
focusPercentage = focusNum/(ageEnd - ageBegin);
focusPercentage = focusPercentage.toString().substr(0,5);
amount = amount.toString().substr(0,4);
amountTop = amountTop.toString().substr(0,4);
amountBottom = amountBottom.toString().substr(0,4);
document.write("从 " + ageBegin + " 岁到 " + ageEnd + " 岁,<br />集中度为 <strong>" + focusPercentage + "</strong>, <br />增值达到 " + amount + "倍,<br />最高 " + amountTop + "<br />最低 " + amountBottom);
function getRandFocus(){
    var rand = Math.random();
    var randInt = Math.floor(rand*100000);
    var result = randInt%2;
    return result;
}


你可能感兴趣的:(职业发展)