there is a difference between jumbling and anagraming
the other day i wrote some python to solve the 9 letter word from the target in the SMH
you can also use a similar principle to find real anagrams
Python code:
from __future__ import with_statement
def ret_words(letter,words):
return [item for item in words if letter in item]
ana=raw_input("jumble: ")
with open("words-english.dic",'r') as dic:
x = set([item for item in [line.strip("\r\n") for line in dic.readlines()] if len(item)==len(ana)])#this only targets words of the right length
a = list(ana)
while a:#this targets words containing the same characters
x = ret_words(a.pop(),x)
a=sorted(ana)
for item in x:#this matches letter patterns to check if it is in fact an anagram
if a == sorted(list(item)):
print item
####################that was the conceptual python
##this is the engineered python
i=raw_input('j: ')
#now the line above and either of the following lines
for item in filter((lambda x: sorted(x) == sorted(i)),[ line.strip("\r\n") for line in open("words-english.dic","r").readlines() if len(line.strip('\r\n'))==len(i)]):print item
#the other solution
for item in [item for item in[line.strip("\r\n") for line in open("words-english.dic","r").readlines() if len(line.strip('\r\n'))==len(i)] if sorted(item)==sorted(i)]:print item
using those filtering principles you should be able to write something to produce anagrams, but if you are trying to jumble words, you could use the code I wrote to generate test cases for my code above
Python code:
import random
def shuffled(x):
random.shuffle(x)
return x
print "".join(shuffled(list(raw_input("String to jumble: "))))