Purpose: To put the random void to some use
Classes Modified: misc.java, client.java
Procedure
Okay, now I bet most of you haven't seen many uses of the random void.
One of the most common is in hitDiff's (hitDiff = 18 + misc.random(8 )). Other then that...
No find.
However, you can apply the random void to almost ANYTHING when you realize the potential.
Here's what the void in misc looks like
Code:
public static int random(int range) { //0 till range (range INCLUDED)
return (int)(java.lang.Math.random() * (range+1));
}
All that this explains is that it imports the int range ((int range) {) and returns the int using a mathematical random value.
We can use this in many ways.
The main base for using it is
Code:
misc.random(X1) == X2
X1 is the overall number, and X2 is the chance of something happening.
This code can be modified over, and over, and over until it suits your needs.
Countless forms are used today.
Let's figure out ONE way we can use this.
In a command we can.
Let's use this base
Code:
if(command.equalsIgnoreCase("X1") && misc.random(2) == 1)) {
sendMessage("Successful");
} else {
sendMessage("Failure");
}
What does this do?
The X1 is the name of the command you'd like...
misc.random(2) == 1 means that there is a 50% chance of getting the message Successful (sendMessage("Successful")) and a 50% chance of getting the message Failure(} else { sendMessage("Failure")).
Other than that, it's pretty easy.
One of the BIG things you can use this for is skills.
Make it real, with chances to burn a fish, to catch a fish or not... up to you.
Have fun.
Credits: Newb 2341
Comment, don't hate.
PM me for help.
Report any errors.