Skip to main content
Tweeted twitter.com/#!/StackCodeReview/status/454032871406436352
deleted 19 characters in body
Source Link
Jamal
  • 34.9k
  • 13
  • 133
  • 237

Here's the details. I'm new when it comes to Java and programming in general, but I feel I have a decent grasp on a lot of the fundamentals. 

I've created this "random planet generator" that is virtually useless aside from minimal entertainment, but I've created it to help solidify what I've been learning. I'm not asking for code, but for a direction with as much info as possible.

So myMy random planet generator lists:

My problem is, that for the name, it is horribly inefficient. Before I added the name field, I could generate millions of random planets in seconds. Now, I only set it to 50,000 planets and it still takes a minute or two to generate them all. here's

Here's the method I use to name the planets;planets:

BTW: theThe name structure would essentially be something like.:

Here's the details. I'm new when it comes to Java and programming in general, but I feel I have a decent grasp on a lot of the fundamentals. I've created this "random planet generator" that is virtually useless aside from minimal entertainment, but I've created it to help solidify what I've been learning. I'm not asking for code, but for a direction with as much info as possible.

So my random planet generator lists:

My problem is, that for the name, it is horribly inefficient. Before I added the name field, I could generate millions of random planets in seconds. Now, I only set it to 50,000 planets and it still takes a minute or two to generate them all. here's the method I use to name the planets;

BTW: the name structure would essentially be something like.

I'm new when it comes to Java and programming in general, but I feel I have a decent grasp on a lot of the fundamentals. 

I've created this "random planet generator" that is virtually useless aside from minimal entertainment, but I've created it to help solidify what I've been learning. I'm not asking for code, but for a direction with as much info as possible.

My random planet generator lists:

My problem is, that for the name, it is horribly inefficient. Before I added the name field, I could generate millions of random planets in seconds. Now, I only set it to 50,000 planets and it still takes a minute or two to generate them all.

Here's the method I use to name the planets:

The name structure would essentially be something like:

Formatting and a title that is not a question
Source Link
rolfl
  • 97.5k
  • 17
  • 218
  • 418

Random planet generator Planetary Nomenclature

So my random planet generator lists; name: temp: size(circumference): Density: Length of Day: Number of Moons: Gravity: If planet has ringslists:

  • name:
  • temp:
  • size(circumference):
  • Density:
  • Length of Day:
  • Number of Moons:
  • Gravity:
  • If planet has rings:

As you can tell, I have 2 text files. One for actual star names, and another for  ("Whatwhat I think is) the Greek alphabet. It randomly picks a line to read up to and uses that name. What could be a faster, more efficient way of doing this? BTW

BTW: the name structure would essentially be something like. Name: Gemini ALPHA-229c

 Name: Gemini ALPHA-229c

I have every planet generated added to an ArrayList one by one after all planets fields are created.

Any suggestions?

Random planet generator

So my random planet generator lists; name: temp: size(circumference): Density: Length of Day: Number of Moons: Gravity: If planet has rings:

As you can tell, I have 2 text files. One for actual star names, and another for("What I think is) the Greek alphabet. It randomly picks a line to read up to and uses that name. What could be a faster, more efficient way of doing this? BTW: the name structure would essentially be something like. Name: Gemini ALPHA-229c

I have every planet generated added to an ArrayList one by one after all planets fields are created.

Planetary Nomenclature

So my random planet generator lists:

  • name:
  • temp:
  • size(circumference):
  • Density:
  • Length of Day:
  • Number of Moons:
  • Gravity:
  • If planet has rings:

As you can tell, I have 2 text files. One for actual star names, and another for  (what I think is) the Greek alphabet. It randomly picks a line to read up to and uses that name. What could be a faster, more efficient way of doing this?

BTW: the name structure would essentially be something like.

 Name: Gemini ALPHA-229c

I have every planet generated added to an ArrayList one by one after all planets fields are created.

Any suggestions?

changed the title to reflect what the code does, remove noise, added beginner tag
Source Link
Marc-Andre
  • 6.7k
  • 5
  • 38
  • 65

improving efficiency (Java) Random planet generator

I have every planet generated added to an arraylistArrayList one by one after all planets fields are created.

Sorry if I have presented this question wrong, and sorry about to noob coding :). Thank you all for any and all help though.

improving efficiency (Java)

I have every planet generated added to an arraylist one by one after all planets fields are created.

Sorry if I have presented this question wrong, and sorry about to noob coding :). Thank you all for any and all help though.

Random planet generator

I have every planet generated added to an ArrayList one by one after all planets fields are created.

Source Link
Loading