Previous in Forum: Good Old UK-tek, Ferranti FM1600B Micro-Computer   Next in Forum: Network Speed Problem
Close
Close
Close
3 comments
Rate Comments: Nested
Member

Join Date: May 2011
Posts: 8

Proper Java Syntax Random

05/15/2011 10:39 PM

What is the New Proper Java Syntax for Global Random Interger Generator ?

Register to Reply
Pathfinder Tags: Random Syntax
Interested in this topic? By joining CR4 you can "subscribe" to
this discussion and receive notification when new comments are added.

"Almost" Good Answers:

Check out these comments that don't yet have enough votes to be "official" good answers and, if you agree with them, vote them!
Guru
Technical Fields - Technical Writing - New Member Engineering Fields - Piping Design Engineering - New Member

Join Date: May 2009
Location: Richland, WA, USA
Posts: 21017
Good Answers: 795
#1

Re: Proper Java Syntax Random

05/15/2011 11:39 PM

Judging by capitalization, spelling, and word order, you seem to have mastered random syntax already.

__________________
In vino veritas; in cervisia carmen; in aqua E. coli.
Register to Reply Score 1 for Good Answer
Guru

Join Date: Feb 2009
Location: Houston, USA
Posts: 946
Good Answers: 244
#2

Re: Proper Java Syntax Random

05/16/2011 7:18 PM

// Use the Random class of the java.util package

// There are many example in the internet, google it

// Use this piece of code in your program

import java.util.*; // import util package for random class

Random ranGen = new Random(); // you can also pass a seed parameter here

int ran = ranGen.nextInt(); // you can also pass an integer parameter here for upper limit of random numbers, lower limit is 0

System.out.println("The random number is " + ran); // for display the number

// - MS

__________________
"All my technical advices in this forum must be consulted with and approved by a local registered professional engineer before implementation" - Mohammed Samad (Linkedin Profile: http://www.linkedin.com/in/msamad)
Register to Reply
Member

Join Date: May 2011
Posts: 8
#3
In reply to #2

Re: Proper Java Syntax Random

05/17/2011 1:25 PM

Hey You Thanks.

It was Math.abs....... I've been hacking the syntax.

This is much easier.

Thanks Again

And import java.util.*;

Register to Reply
Register to Reply 3 comments

"Almost" Good Answers:

Check out these comments that don't yet have enough votes to be "official" good answers and, if you agree with them, vote them!
Copy to Clipboard

Users who posted comments:

CatBurglerV8 (1); msamad (1); Tornado (1)

Previous in Forum: Good Old UK-tek, Ferranti FM1600B Micro-Computer   Next in Forum: Network Speed Problem

Advertisement