Results 1 to 2 of 2
Thread: Random number generation
- 09-30-2009, 11:30 AM #1
Member
- Join Date
- Sep 2009
- Posts
- 1
- Rep Power
- 0
- 09-30-2009, 11:41 AM #2
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
So a random number from
0 to 8999999999999999 (8 + 15 9's) plus 1000000000000000 (1 + 15 0's)
will give you what you want, right?
So, check out the Random class and it's nextLong() method. Then, before adding 1000000000000000 (actually , make sure that the returned long is smaller than 8999999999999999 (8 + 15 9's) and at least 0 (although you could simply take the abs value and not have to worry about checking for negativity) if not use nextLong again.Last edited by masijade; 09-30-2009 at 11:46 AM.
Similar Threads
-
Generating a random number
By oridov in forum New To JavaReplies: 2Last Post: 11-29-2008, 05:12 PM -
Random number generater
By kickflipper1087 in forum New To JavaReplies: 6Last Post: 10-21-2008, 10:19 PM -
Random number help
By jgonzalez14 in forum New To JavaReplies: 5Last Post: 09-16-2008, 09:13 AM -
Random number
By jithan in forum Advanced JavaReplies: 1Last Post: 06-13-2008, 01:42 PM -
random generation
By carlos123 in forum New To JavaReplies: 10Last Post: 01-09-2008, 03:43 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks