0
   

Random Story-Idea Generator

 
 
Jxargo
 
Reply Wed 14 Jun, 2017 11:42 pm
Hi,

I've been coding in a few languages for a little while now, but I am still reluctant to say that I am anything but a beginner. I am eager to learn and do the work, but I need some help in being pointed in the right direction.

I want to create a random story-idea generator. Eventually I want to create an app, but for now I am working on a simple website (because that's what I know). The user will visit the website and click a button to generate a random story idea/writing prompt.

So far I have come up with a simple Javascript function which chooses a random string variable from an array.

var ideas = [
'Something.', 'Something Else.'
]
function newIdea() {
var randomNumber = Math.floor(Math.random() * (ideas.length));
document.getElementById('ideaDisplay').innerHTML = ideas[randomNumber];
}

The problem is I am new at this and there is almost certainly a better way to do it. Additionally, I would also want the generator to have more complex functions such as filtering, e.g. by genre, character or setting.

Q1) Is there a better way for me to create a database of generator results than simply hard coding them?

Q2) How would I go about making the generator more complex?

Any ideas welcome and appreciated.


Thanks in advance.
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Question • Score: 0 • Views: 1,835 • Replies: 0
No top replies

 
 

Related Topics

 
  1. Forums
  2. » Random Story-Idea Generator
Copyright © 2024 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 10/03/2024 at 10:33:05