LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-29-2007, 02:55 PM   #1
manolakis
Member
 
Registered: Nov 2006
Distribution: xubuntu
Posts: 464

Rep: Reputation: 37
Java random from a range


Hi there
I would be pleased if someone could tell me how to generate a random number from a set of possible range in Java (ex -1 >= random <=1 ).

Many thanks
 
Old 10-29-2007, 03:24 PM   #2
PatrickNew
Senior Member
 
Registered: Jan 2006
Location: Charleston, SC, USA
Distribution: Debian, Gentoo, Ubuntu, RHEL
Posts: 1,148
Blog Entries: 1

Rep: Reputation: 48
http://java.sun.com/j2se/1.4.2/docs/...il/Random.html

That site will get you random integers of all values. Then it's just a matter of transforming the values into the distribution you want.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Java random numbers in arrays thtr2k Programming 5 10-24-2007 02:53 AM
random java number?!?!?! trscookie Programming 2 07-18-2006 12:10 PM
java- static messing with random number generation titanium_geek Programming 8 10-15-2005 01:39 PM
Shell scripting - Random numbers within a range felixc Linux - Newbie 2 10-09-2005 05:41 PM
Java Math.random and Tables problem Vizy Programming 4 12-27-2004 11:27 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration