Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search Coderanch
Advance search
Google search
Register / Login
joyce ann casayuran
Greenhorn
+ Follow
1
Posts
0
Threads
0
Cows
since Dec 16, 2002
Merit Badge info
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
Ranch Hand Scavenger Hunt
Number Posts (1/100)
Number Threads Started (0/100)
Number Cows Received (0/5)
Number Likes Received (0/10)
Number Likes Granted (0/20)
Set bumper stickers in profile (0/3)
Report a post to the moderators (0/1)
Edit a wiki page (0/1)
Create a post with an image (0/2)
Greenhorn Scavenger Hunt
First Post
Number Posts (1/10)
Number Threads Started (0/10)
Number Likes Received (0/3)
Number Likes Granted (0/3)
Set bumper stickers in profile (0/1)
Set signature in profile
Search for a post/thread (0/3)
Set a watch on a thread
Save thread as a bookmark
Create a post with an image (0/1)
Recent posts by joyce ann casayuran
Math.random().....any formula to adjust required range?
i found this code on the web.
and i think this is also a greate Random class
public class MyRandom { // Return a random double in [0,1). public static double dblRandom() { return Math.random(); } // Return a random double in [0,high). public static double dblRandom(double high) { return Math.random()*high; } // Return a random double in [low,high). public static double dblRandom(double low, double high) { return Math.random()*(high - low) + low; } // Return a random integer from low to high (inclusive). public static int intRandom(int low, int high) { int nb = high - low + 1; return (int)(Math.random()*nb + low); } // Return a random integer from 1 to n inclusive. public static int intRandom(int n) { return (int)(Math.random()*n + 1); } // Return a random bit (0 or 1). public static int bitRandom() { return (int)(Math.random()*2); } // Return a random boolean (false or true). public static boolean boolRandom() { return Math.random() >= 0.5; } }
hope this will help
show more
19 years ago
Java in General