Results 1 to 8 of 8
- 02-07-2012, 05:42 AM #1
Member
- Join Date
- Feb 2012
- Posts
- 4
- Rep Power
- 0
How do I create a code that generates random text?
How do I create a code that generates random text?
I know how to create a random int generator for colors, but not for text.
I want to display three different phrases randomly upon my mouse leaving the canvas. ex. public void onMouseExit(Location point)
I'm using Blue J/objectdraw by the way.
- 02-07-2012, 05:53 AM #2
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,545
- Rep Power
- 11
Re: How do I create a code that generates random text?
You could put the phrases into an array, then use a randomly chosen value as the index into that array.
- 02-07-2012, 04:49 PM #3
Member
- Join Date
- Feb 2012
- Posts
- 4
- Rep Power
- 0
Re: How do I create a code that generates random text?
I'm sorry I don't exactly understand how to do that... Example would be nice?
- 02-07-2012, 06:38 PM #4
Re: How do I create a code that generates random text?
I'm sure it would, but, assuming you already know how to copy/paste, you wouldn't learn anything new that way.
Which part are you having trouble with? This?
Or this?
Or this?
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 02-07-2012, 06:40 PM #5
Member
- Join Date
- Dec 2011
- Location
- Croatia,Zagreb
- Posts
- 21
- Rep Power
- 0
Re: How do I create a code that generates random text?
example:
something like this ?Java Code:// Moderator edit: full solution removed
i wonder how u even made some project doing some stuff and u dont know how to get random item from array :O -.-'Last edited by DarrylBurke; 02-07-2012 at 10:41 PM. Reason: Removed spoonfeeding
- 02-07-2012, 10:27 PM #6
Member
- Join Date
- Feb 2012
- Posts
- 35
- Rep Power
- 0
Re: How do I create a code that generates random text?
SORRY THAT'S AN INT, I DIDN'T READ THE POST.Java Code:import java.util.Random; public class Main { int rand = new Random().nextInt(HOW MUCH YOU WANT THE LARGEST NUMBER TO BE) + 1; System.out.print(ran); }
- 02-07-2012, 10:46 PM #7
Re: How do I create a code that generates random text?
ContoNick, please don't spoonfeed. That deprives the questioner of the opportunity to learn. I've edited your post and removed the full solution.
rokit boy, we still don't know what part the OP is stuck on. I've broken the problem into three parts, we should wait for a reply so that we don't waste effort and forum space suggesting what is already known.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 02-08-2012, 11:01 AM #8
Member
- Join Date
- Dec 2011
- Location
- Croatia,Zagreb
- Posts
- 21
- Rep Power
- 0
Similar Threads
-
My program generates new errors
By BenH in forum New To JavaReplies: 8Last Post: 01-31-2012, 06:21 AM -
HELP! not sure how to create random Array
By vanilla88 in forum New To JavaReplies: 3Last Post: 09-30-2011, 10:10 AM -
Hello? How to Create Random access???
By Miyaki in forum New To JavaReplies: 1Last Post: 03-05-2009, 06:37 AM -
Random access to text file
By lunarbof in forum New To JavaReplies: 1Last Post: 11-05-2008, 08:53 PM -
Generates random maths questions
By cachi in forum New To JavaReplies: 4Last Post: 08-01-2007, 04:48 AM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks