Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Rate executes some funcions by specified rate.
JavaScript
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
README
rate.js

README

NAME
	Rate

DESCRIPTION
	Rate executes some funcions by specified rate.

CONSTRUCTER
	ins = new Rate(num maxRate);
	maxRate :the maximum of probability.
		 Default 100
		 type 'number'
METHODS
	ins.add(num rate or str 'default',func function)
		 add rate and function to setValues.
		 'default' must be defined.
		 The summention of all registered rates cannot exceed max rate.
	ins.generate()
		 execute each methods by its rates.
	ins.clear()
		 initialize all registered values and functions.
EXAMPLES
	var rate = new Rate(100);//max rate
	rate.add(0.1,func1()); //0.1%
	rate.add( 2,func2()); //2%
	rate.add('default',funcDefault()); //97.9%
	var result = rate.generate(); //return the result of executing funcDefault or func1 or func2

AUTHOR
	Yuhei Nakasaka <Twitter:@razokulover> 
LICENSE
	GPL
Something went wrong with that request. Please try again.