Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-28-2008, 06:46 AM
Member
 
Join Date: Apr 2008
Posts: 5
Shadow22202 is on a distinguished road
Scrambling Words
All I need to know how to do is scramble a word such as "Superman" so that each time I run the program is jumbles the word (i.e. punamres or seurmpan). Each run needs to be a different "scramble" Thank you
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-28-2008, 07:08 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,403
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
How about randomly generate characters and build the string?
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
(Close on July 13, 2008)
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 04-28-2008, 07:47 AM
Member
 
Join Date: Apr 2008
Posts: 5
Shadow22202 is on a distinguished road
I need to know how to do that, however I dont think that will work, I need to have a word bank and from that word bank use an array to grab a word then shuffle it.
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 04-28-2008, 08:02 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,403
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
What you mean a word bank? You mean you have a bunch of scramble words with you? If so it is too easy.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
(Close on July 13, 2008)
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 04-28-2008, 08:31 AM
Zosden's Avatar
Senior Member
 
Join Date: Apr 2008
Posts: 354
Zosden is on a distinguished road
I would just put the string into a char vector and then just pull out random indexes from it then put that into an array in order. That would work the best. if you want to do your way, which by the way is stupid. then just have your arrays hard coded into the code then just use a switch statement to figure out which one to use.
__________________
My IP address is 127.0.0.1
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 04-28-2008, 08:36 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,403
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Yep, that what I want to figure out pal. If he already stored words, in an array, list, etc.., randomly generate the index and refer that indexed word.

It's much simple, rather generating the random characters.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
(Close on July 13, 2008)
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 04-28-2008, 08:48 AM
Zosden's Avatar
Senior Member
 
Join Date: Apr 2008
Posts: 354
Zosden is on a distinguished road
Oh I'm sorry I misinterpreted what he meant. I thought he meant he wanted to have a user input words then pick from an array that had the word already scrambled. I apologies for misreading.
__________________
My IP address is 127.0.0.1
Bookmark Post in Technorati
Reply With Quote
  #8 (permalink)  
Old 04-28-2008, 09:01 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,403
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Don't worry pal. Anytime anyone can make mistakes.

Don't worry.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
(Close on July 13, 2008)
Bookmark Post in Technorati
Reply With Quote
  #9 (permalink)  
Old 04-29-2008, 09:30 PM
aleshivan's Avatar
Member
 
Join Date: Apr 2008
Posts: 1
aleshivan is on a distinguished road
Scrambling String
Quote:
Originally Posted by Shadow22202 View Post
All I need to know how to do is scramble a word such as "Superman" so that each time I run the program is jumbles the word (i.e. punamres or seurmpan). Each run needs to be a different "scramble" Thank you
para revolver una palabra yo haria lo siguiente:
Code:
public int randPos(int max){ return (int)(max * Math.random()); } public String scrambleString(String inStr){ char[] chars = inStr.toCharArray(); for (int i = chars.length - 1; i > 0; i--) { int guest = randPos(i); char current = chars[guest]; chars[guest] = chars[i]; chars[i] = current; } return new String(chars); }
Buena suerte
__________________
Alex Roldan HD.
Parquesoft - Cali, Colombia

Last edited by aleshivan : 04-29-2008 at 09:49 PM. Reason: Corrección de estilo
Bookmark Post in Technorati
Reply With Quote
  #10 (permalink)  
Old 04-30-2008, 04:51 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,403
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Dear aleshivan,

Welcome to our community.

I can't understand your language here. I think not only for me, most of us here in this community. So please make all your replays in English, which is everyone can understand.

I hope you get what I say.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
(Close on July 13, 2008)
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extracting words from a string using delimiters toad New To Java 4 07-07-2008 02:32 PM
help w words Gilgamesh New To Java 5 11-21-2007 07:15 PM
program help: Extracting words from a string toad New To Java 1 11-04-2007 07:39 PM
Analyze a string of words zoe Advanced Java 2 07-26-2007 11:01 AM
Aspose.Words for Java - 2.1.0.0 levent Java Announcements 0 05-24-2007 11:08 AM


All times are GMT +3. The time now is 11:34 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org