I need to generate a random number between -99 to 99, how do I code this? This is what I have so far, but it always comes out negative
Random gererator=new Random();
num1=Math.abs(generator.nextInt()) % 99 + -99;
How do I fix it?
Results 1 to 3 of 3
Thread: Help with random generator
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL