text:
Implement Bogosort
Is solving Sudoku too hard? Even the brute force version? Here's a coding exercise that's a little easier. I hope. :-P
Write the shortest function to implement bogosort. In specific, your function should:

Take an array (or your language's equivalent) as input
Check if its elements are in sorted order; if so, return the array
If not, shuffle the elements, and start again

The shortest entry wins. In the case of a tie, a function that supports a custom comparator (and/or pseudorandom number generator) is favoured. Any remaining ties are resolved by favouring the earlier submission.

Clarifications: You can use any element type you want, as long as there's some way to order them, of course. Also, the shuffling has to be uniform; none of this "I'll just quicksort it and call it shuffled" business. :-)

What are the element types? int or strings?

@Alexandru: Either is fine. You choose.

Adding a custom comparator will increase the code length so a winning entry will not have a custom comparator. I think breaking the tie doesn't make sense.

@Alexandru: If you have to code your comparison by hand (e.g., in GolfScript), making it support custom comparators is easy. However, your point is generally valid.

sorted ascending, descending or either?

It's possible that this algorithm can fail when using pseudo random generator. eg when the length of the list exceeds say 2000, there are 2000! states for the list which may exceed the number of interal states of the prng.

@Eelvex: Either is fine. Indeed, with a custom comparator, changing a < to > is all that's required to change the sort direction. :-)

@gnibbler: Bogosort is not required to terminate. In fact, its worse case complexity is O(∞), according to Wikipedia.

Yes, the relevant quote from wikipedia "However, if a pseudorandom number generator is used in place of a random source, it may never terminate, since these exhibit long-term cyclic behavior."

Must we check of the array is sorted prior to shuffling?  Or can we initially shuffle then check whether it's sorted?

@Nemo157: That is fine too.

Just so it's been said, requiring a function that returns something does actually block some answers that might otherwise be interesting/valid approaches.

APL(Dyalog), 20
{⍵≡⍵[⍋⍵]:⍵⋄∇⍵[?⍨⍴⍵]}

Explanation
⍵ is the (right) argument
⍵≡⍵[⍋⍵]: Checks if ⍵ sorted equals ⍵ itself
:⍵: If yes, then return ⍵
∇⍵[?⍨⍴⍵]: Else, generate an array of 1 to ⍴⍵ (length of ⍵) in random order, reorder ⍵ according to that (⍵[...]), and apply the function to it (∇)

Suddenly revisiting this problem and...
APL(Dyalog), 19
{∧/2≤/⍵:⍵⋄∇⍵[?⍨⍴⍵]}

Was just thinking about sorting an array in the check makes it kind of pointless (not saying that Bogosort is meaningful), a more accurate implementation would be ∧/2≤/⍵, and that happens to lower the char count.

Perl 6: 23 chars
@s.=pick(*)until[<=] @s

Is this a function in perl? It looks nice :)

If you don't know, [<=] checks if a list is sorted: [<=] (1, 2, 3,) == (1 <= 2 <= 3) == (1 <= 2) and (2 <= 3), and .pick(n) chooses n random elements from a list, and .pick(*) lets Perl pick all elements. http://use.perl.org/~masak/journal/40459

This must be Perl 6.  I've never seen pick used before, let alone [<=].  Where in the documentation are those?

@GigaWatt This is Perl 6 (not Perl 5). [] is reduce operator which takes operator between square brackets. For example, [<=] 1, 2, 3 is 1 <= 2 <= 3 (and yes, you do ranges like this in Perl 6). In this case, it's used to determine if elements are in order. .pick(*) method shuffles the list (pick(N) picks N elements from list). .= calls method, and assigns the result to the variable. As for documentation - well, for now only Perl 6 specification exists - http://feather.perl6.nl/syn/, but it exists.

Ruby - 33 characters
g=->l{l.shuffle!!=l.sort ?redo:l}

1 char less: g=proc{|l|0until l.sort==l.shuffle!}

@AShelly, your version doesn't work. My version (5 chars less) f=->l{l.sort!=l.shuffle!?redo:l} (Ruby 1.9)

can someone please explain to me why redo works with a proc but not in a classical method with def...end? I thought redo only works with loops?

Ok never mind, i found something in 'The Ruby Programming Language' book: ”redo […] transfers control back to the beginning of the proc or lambda“. It simply is that way.

APL (22)
{(⍳X←⍴⍵)≡⍋⍵:⍵⋄∇⍵[X?X]}

Usage:
    {(⍳X←⍴⍵)≡⍋⍵:⍵⋄∇⍵[X?X]} 3 2 1
1 2 3

Explanation:

⍋⍵: returns the indexes of the items in sorted order, so ⍋30 10 20 gives 2 1 3
(⍳X←⍴⍵)≡⍋⍵:⍵ Store the length of input list in X. If range [1..X] is equal to the sorted index order, the list is sorted, so return it.
⋄∇⍵[X?X]: if this is not the case, recurse with shuffled array.

Mathematica, 40 37
NestWhile[RandomSample,#,Sort@#!=#&]&

With whitespace:
NestWhile[RandomSample, #, Sort@# != # &] &

If you ignore errors, you can save three bytes with #//.l_/;Sort@l!=l:>RandomSample@l&

13sh bytes in Mthmca.

J - 34 27
f=:({~?~@#)^:(1-(-:/:~))^:_

eg:
f 5 4 1 3 2
1 2 3 4 5

f 'hello'
ehllo

The {~ ?~@# part shuffles the input:
({~ ?~@#) 1 9 8 4
4 8 9 1
({~ ?~@#) 'abcd'
bdca

Python 61
Sorts in place.
import random
def f(l):
 while l!=sorted(l):random.shuffle(l)

Your function does not return the array on success.

Sorts in place. The passed array is modified.

The question does say that the function is supposed to return the array though - even if it isn't technically necessary to get the result.

from random import* can save a char.

This may not always work: (from python random module documentation): "Note that for even rather small len(x), the total number of permutations of x is larger than the period of most random number generators; this implies that most permutations of a long sequence can never be generated."

Wouldn't a lambda be shorter?

@J843136028, Python doesn't let you have a while loop in a lambda

K, 31 25
{while[~x~x@<x;x:x@(-#x)?#x];x}
{x@(-#x)?#x}/[{~x~x@<x};]

.
k){x@(-#x)?#x}/[{~x~x@<x};] 3 9 5 6 7 9 1
`s#1 3 5 6 7 9 9

.
k){x@(-#x)?#x}/[{~x~x@<x};] "ascsasd"
`s#"aacdsss"

Python 94
from itertools import*
def f(a):return [x for x in permutations(a) if x==tuple(sorted(a))][0]

Other python answers use random.shuffle(). The documentation of the python random module states:

Note that for even rather small len(x), the total number of
  permutations of x is larger than the period of most random number
  generators; this implies that most permutations of a long sequence can
  never be generated.

Do a lambda instead; I think it would be shorter. Also note that you can do return[x... as opposed to return [x.... Same with permutations(a) if -- it could be permutations(a)if.

lambda a: [x for x in __import__("itertools").permutations(a) if x==tuple(sorted(a))][0] is 88 bytes

Python - 61 chars
Recursive
from random import*;f=lambda l:l==sorted(l)or shuffle(l)>f(l)

Your function returns True or False, not the array.

Also note that recursive solutions are doomed to failure even for small inputs.

@hallvabo: I actually want to write a tail-recursive solution in Scheme, which won't deplete your stack, of course.

@hallvabo, Alexandru had already done the obvious Python solution, so I was just going for something different here. Of course the recursive solution is just for fun and not a serious contender

from random import* might be shorter.

@J843136028, thanks. But I seem to have gotten the original byte count wrong, so it's still 61

Python (69 chars)
from random import*
def f(a):
 while a>sorted(a):shuffle(a)
 return a

Sorts integers in increasing numeric order.
Note that recursive solutions, like
from random import*;f=lambda a:a>sorted(a)and(shuffle(a)or f(a))or a
will fail due to stack overflow for even small inputs (say N>5), because Python does not do tail-call optimisation.

D without custom comparator: 59 Characters
R f(R)(R r){while(!isSorted(r))r.randomShuffle();return r;}

More Legibly:
R f(R)(R r)
{
    while(!r.isSorted)
        r.randomShuffle();

    return r;
}

D with custom comparator: 69 Characters
R f(alias p,R)(R r){while(!isSorted!p(r))r.randomShuffle();return r;}

More Legibly:
R f(alias p, R)(R r)
{
    while(!isSorted!p(r))
        r.randomShuffle();

    return r;
}

Scala 73:
def s(l:Seq[Int]):Seq[Int]=if(l==l.sorted)l else s(util.Random.shuffle l)

In Scala, we can check whether the compiler did a tail-call optimization:
@annotation.tailrec
def s(l:Seq[Int]):Seq[Int]=if(l==l.sorted)l else s(util.Random shuffle l)

and yes, it did. However, for a short List of 100 values:
val rList = (1 to 100).map(x=>r.nextInt (500))
s(rList)

took nearly 4 months to complete. ;)

C# (184 chars)
T[]S<T>(T[]i)where T:IComparable<T>{T l=default(T);while(!i.All(e=>{var r=e.CompareTo(l)>=0;l=e;return r;})){i=i.OrderBy(a=>Guid.NewGuid()).ToArray();l=default(T);}return i.ToArray();}

It's not really nice to do this in C#. You have to support generics to support both value and reference types. There is no array shuffle function or function to check if something is sorted.
Does anybody got any tips to make this better?
Edit
Version that only sorts int (134 chars):
int[]S(int[]i){var l=0;while(!i.All(e=>{var r=e>=l;l=e;return r;})){i=i.OrderBy(a=>Guid.NewGuid()).ToArray();l=0;}return i.ToArray();}

GNU/BASH 65
b(){ IFS=$'\n';echo "$*"|sort -C&&echo "$*"||b $(shuf -e "$@");}

Hmm, can I get a special exception to the return the array rule since bash functions can only literally return an unsigned byte?

C++11, 150 characters
#include<deque>
#include<algorithm>
void B(std::deque &A){while(!std::is_sorted(A.begin(),A.end())std::random_shuffle(myvector.begin(),myvector.end());}

Just.. made for fun.

std::random_shuffle is not uniform. In the clarifications it is stated: "Also, the shuffling has to be uniform"

Okay... i didn't know it was not uniform.

It relies on rand() which is not uniform -- see http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3924.pdf . Not many other people are seem to be following so meh i guess it's not a big deal.

So if I use a fully random one like using srand(time(0)) then does it count?

Problem is that rand is not guaranteed to have good quality of random numbers let alone uniformity, some produce non-random low-order bits. I guess it doesn't nor should matter in the end. I only got 8 more bytes using a uniform distributor with std::shuffle and so forth, good enough for me.

C++14, 158 bytes
#include <algorithm>
#include <random>
[](int*a,int s){std::random_device r;for(std::knuth_b g(r());!std::is_sorted(a,a+s);std::shuffle(a,a+s,g));return a;};

you can reduce <algorithm> to <regex>; the latter includes the former automatically, also, you can remove whitespaces in the two #includes

PowerShell, 85 82 56 55 52 bytes
-26 bytes thanks to mazzy's suggestions
-1 byte thanks to AdmBorkBork
-3 bytes thanks to mazzy
for($l=$args;"$l"-ne($l|sort)){$l=$l|sort{random}}$l

Try it online!
PowerShell does have a relatively cheap array comparison by casting them to strings and comparing that.

Move your param initialization into your for initialization to save a byte -- for($l=$args;

nice. -ne casts the right operator to a scalar type of the left operator. so, you can save a few bytes: Try it online!

JavaScript, 98 92 chars
More precisely ECMAScript 2015 (ES6)
Minified:
let b=r=>{for(;!r.every((o,t)=>o==[...r].sort()[t]);)r.sort(()=>Math.random()-.5);return r};

Invocation: console.log(b([3, 2, 1, 5, 67, 4, 6, 5, 6, 4]))
Not minified:
let bogoSort = (myArray) => {
  while (!myArray.every((v, i) => v == [...myArray].sort()[i])) {
    myArray.sort(() => Math.random() -0.5)
  }
  return myArray
}

Explanation:

myArray.every() is an element-wise compare function. Comparing shuffled with sorted array
someArray.sort() sorts in place so saving assignments, but also needs cloning for the sorted array
[...myArray] clones the array (array destructuring)
() => (Math.random() > .5) ? 1 : -1 is a custom compare function. Coin flip whether to order an element in front or behind

Go 1.20+, 95 bytes
import(."math/rand";."sort")
func f[T Interface](I T){for!IsSorted(I){Shuffle(I.Len(),I.Swap)}}

Attempt This Online!
Expects input to implement sort.Interface, which wants:

Len() int: gets the number of elements.
Less(i, j int) bool: checks whether the element at index i is less than the element at index j.
Swap(i, j int): swaps elements at indexes i and j.

Why is this 1.20+? See below.
Go, 158 bytes, seeded ints (pre-1.20)
import(."math/rand";."sort";."time")
func f(I[]int)[]int{Seed(Now().Unix())
for!IntsAreSorted(I){Shuffle(len(I),func(i,j int){I[i],I[j]=I[j],I[i]})}
return I}

Attempt This Online!
Go, 131 bytes, unseeded ints (pre-1.20), truly random (post-1.20)
import(."math/rand";."sort")
func f(I[]int)[]int{for!IntsAreSorted(I){Shuffle(len(I),func(i,j int){I[i],I[j]=I[j],I[i]})}
return I}

Attempt This Online!
This solution is marked as both "unseeded" and "truly random" due to a change in Go v1.20 that changed the global, default random number generator to be seeded "randomly" rather than be default, deterministic rand.Seed(1) in pre-1.20 versions.

Javascript 291 characters
min
function f(e){var t=[].concat(e).sort();t.e=function(e){var n=true;t.forEach(function(t,r){if(t!=e[r])n=false});return n};while(!t.e(e.sort(function(){return Math.floor(Math.random()*2)?1:-1}))){console.log(e)}return e}

un-min
function f(a) {
var b = [].concat(a).sort();
b.e = function (z) {
    var l = true;
    b.forEach(function (v, i) {
        if (v != z[i]) l = false;
    });
    return l
};
while (!b.e(a.sort(function () {
    return Math.floor(Math.random() * 2) ? 1 : -1;
}))) {
    console.log(a);
}
return a;
}

I have a feeling I've said this before, but you can remove all the vars. Just make them all implicit globals, it's just about making the code as short as possible.

Python, 71 characters
from random import*
def b(l):
 while l!=sorted(l):shuffle(l)
 return(l)

Not the shortest one, but it works.
Ungolfed:
from random import *
def bogosort(list):
    while list != sorted(list):
        shuffle(list)

    return(list)

Usage:
Input: b([1, 7, 3, 9, 2])
Output: [1, 2, 3, 7, 9]

Return isn't a function, you don't need parenthesis...

you can use l<sorted(l) instead of !=

Matlab, 59 bytes
Relatively straight forward approach:
x=input('');while~issorted(x);x=x(randperm(numel(x)));end;x

J, 22 bytes
$:@({~?~@#)`]@.(-:/:~)

This is a recursive, tacit monad using an agenda. Here's how it works:
Let y be our list. First, the verb on the right of the agenda is -:/:~. This a verb graciously provided by Leaky Nun. It matches (-:) whether or not the input is sorted (/:~) using a monadic hook. ((f g) y = y f (g y)) This returns a one or a zero accordingly. The left hand side of the agenda is a gerund of two verbs: on the right is the identity verb ], and on the left is where the recursion takes place. The agenda selects either the identity verb at position 1 if the list is sorted, and the longer verb at position 0 if the list isn't sorted.
$:@({~?~@#) calls $: (the longest verb it is contained in) atop the result of {~?~@# on y. This shuffles the list, as ?~@# takes the permutations of the length of y, being randomly-sorted indices of y. {~, in a monadic hook, returns a list from y whose indices are the right arg. This shuffled list is then called again with the agenda, and repeats until it is sorted.

Pushy, 8 bytes
[oSog?_i

Try it online!
Alternatively, run this version to see it print each shuffle as it goes along! The code works like this:
[          \ Infinitely:
 oS        \   Shuffle the stack
   og?     \   If it's sorted (ascendingly):
      _i   \     Print and terminate

If you want to sort descendingly, just replace og with oG.

05AB1E, 8 bytes
[Ð{Q#.r

Try it online!
Explanation:
[        # Infinite Loop start
 Ð       # Push input
  {Q#    # If input is sorted, break loop
     .r  # Otherwise, shuffle

Jelly, 6 bytes, language postdates challenge
ẊŒ¿’$¿

Try it online!
Explanation
ẊŒ¿’$¿
     ¿  While
 Œ¿’$     the input is not in its earliest possible permutation (i.e. sorted)
Ẋ       shuffle it

Œ¿ assigns a number to each permutation of a list; 1 is sorted, 2 has the last two elements exchanged, etc., up to the factorial of the list length (which is the list in reverse order). So for a sorted list, this has the value 1, and we can decrement it using ’ in order to produce a "not sorted" test that's usable as a Boolean in a while loop condition. The $ is to cause the condition to parse as a group.

Brachylog (v2), 5 bytes
≤₁|ṣ↰

Try it online!
Function submission. (The TIO link uses a command-line argument that automatically wraps a function into a full program.)
Explanation
≤₁|ṣ↰
≤₁      Assert that {the input} is (nonstrictly) sorted in ascending order
  |     Output it
  |     Exception handler: if an assertion fails:
   ṣ      Randomly shuffle {the input}
    ↰     and run this function recursively on it, {outputting its output}

Prolog (the language that Brachylog compiles into) is tail-recursive, so this function ends up being compiled into a tight loop.

C++, 166 bytes
Meh.
#import<algorithm>
#import<random>
#define r b.begin(),b.end()
template<class v>
v f(v b){auto a=std::mt19937();while(!std::is_sorted(r))std::shuffle(r,a);return b;}

This should work on all STL containers that have begin() and end().
Ungolfed:
#include <algorithm>
#include <random>
template <class v>
v f(v b) {
    auto a = std::mt19937();
    while (!std::is_sorted(b.begin(),b.end()))
        std::shuffle(b.begin(),b.end(),a);

    return b;
}

APL (Dyalog Extended), 15 bytes
(?⍨∘≢⊇⊢)⍣{⍺≡∧⍺}

Try it online!

14 bytes ?⍨∘≢⍛⊇⍨⍣{⍺≡∧⍺}

Brachylog, 5 bytes
∈&ṣ≤₁

Try it online!
When I first saw ais523's Brachylog answer (as opposed to his Jelly answer, because if I'm not mistaken user62131 was also him), I wondered, what if it used backtracking instead of recursion? So at first, I tried ṣ≤₁. Turns out, since choosing something at random doesn't produce multiple outputs so much as it just produces one output nondeterministically, the shuffle predicate ṣ can't be backtracked to, so running that will simply fail unless you're lucky enough to shuffle it right on the first try. After that, I tried pṣ≤₁, which worked most of the time, but since a finitely long list has finitely many permutations, it still failed at random sometimes. After having abandoned the goal of achieving length reduction, I finally came up with this:
         The input
∈        is an element of
         an unused implicit variable,
 &       and the input
  ṣ      shuffled randomly
   ≤₁    which is increasing
         is the output.

(Demonstration of randomness)
Although it actually can be a bit shorter if we take some liberties with I/O...
Brachylog, 4 bytes
⊆ṣ≤₁

Try it online!
In order for the output to be useful, the input must not contain any duplicate elements, because in addition to sorting the input, this bogosort predicate adds in a random number of duplicate elements and zeroes. (Hypothetically, it could add in anything, but it just kind of doesn't.) Ordinarily I wouldn't bother mentioning something so far from correctly functioning, but I feel it's in the spirit of the challenge.
⊆        An ordered superset of the input
 ṣ       shuffled randomly
  ≤₁     which is increasing
         is the output.

Japt, 11 9 bytes
_eZñ}a@öx

Try it
_eZñ}a@öx     :Implicit input of array U
_             :Function taking an array as argument via parameter Z
 e            :  Test Z for equality with
  Zñ          :  Z sorted
    }         :End function
     a        :Repeat and return the first result that returns true
      @       :Run this function each time and pass the result to the first function
       öx     :  Random permutation of U

Perl 6, 28 bytes
{({.pick(*)}...~.sort).tail}

Try it online!
Anonymous code block that shuffles the list until it is sorted. Note that it sorts the list at least once, which is allowed. And no, the {.pick(*)} can't be replaced with *.pick(*)

Pyth, 11 bytes
Wn=Q.SQSQ;Q

Pretty happy with this, probably can be golfed a bit more
Explanation

Wn=Q.SQSQ;Q
W    While
  =Q.SQ    Variable Q (input variable) shuffled
 n  Does not equal
       SQ    Variable Q sorted
             ;  Do nothing (loop ends)
              Q    And output variable Q

Try it online!

You can shorten =Q.SQ to =.SQ for -1 byte (works with other operators too, like =QhQ-> =hQ)

Java, 252
Requires java 10 as the varkeyword is used.
import java.util.*;interface B{static int c(List<String>a,int i){return i>0?Math.max(a.get(i-1).compareTo(a.get(i)),c(a,i-1)):-1;}
static void main(String[]p){var a=Arrays.asList(p);while(c(a,a.size()-1)>0)Collections.shuffle(a);System.out.print(a);}}

Explained
import java.util.*;                              // you don't get a lot for free in java
interface B{
  static int c(List<String>a,int i){             // recursive comparator method, i is index to compare a[i-1] with a[i]
    return i>0?                                  // still not at the first element?
           Math.max(                             // return the max of...
             a.get(i-1).compareTo(a.get(i)),     // - string comparison of a[i-1] and a[i]
             c(a,i-1))                           // - recursive call c for i-1
           :-1;                                  // i=0 -> return -1
  }
  static void main(String[]p){                   // entry point
    var a=Arrays.asList(p);                      // convert the input array in a List (so we can use Collections functions)
    while(c(a,a.size()-1)>0)                     // as long as c()>0, at least one element is not in correct order
      Collections.shuffle(a);                    // shuffle the list
    System.out.print(a);                         // print the ordered list
  }
}

Try it online

Vyxal, 8 bytes
{ÞṠ¬|Þ℅:

Try it Online!
Explanation
{ÞṠ¬|Þ℅:  # Implicit input
{   |     # While loop
 ÞṠ       # (Condition): Is sorted?
   ¬      #              Logical NOT
     Þ℅   # (Body): Randomly shuffle
       :  #         Duplicate
          # Implicit output

C (203 chars, no input loop: only the func)
#include <stdio.h>
#define P (int*a,int n){
#define F for(i=0;i<n;i++){
int i,j,v;s P F if(a[i]>a[i+1])return 0;}return 1;}void h P F v=a[i];a[i]=a[j=rand()%n];a[j]=v;}}void b P while(!s(a,n-1))h(a,n);}

This is the same as the following, where we also read the array from stdin and write out the sorted array. Since the Q asked for the function and not a whole program...
C (296 chars)
#include <stdio.h>
#define P (int*a,int n){
#define F for(i=0;i<n;i++){
int i,j,n,v,x[999];s P F if(a[i]>a[i+1])return 0;}return 1;}void h P F j=rand()%n;v=a[i];a[i]=a[j];a[j]=v;}}void b P while(!s(a,n-1))h(a,n);}main(){while(scanf("%d",&v)==1)x[n++]=v;if(!s(x,n))b(x,n);F printf("%d\n",x[i]);}}

Compiling may give warning (implicit declarations). Hardencoded array size limit of 999 elements. Fragile.
if there's no need to pre-check if the array is sorted, it can be done in 284.
C (251 chars, was 284)
#include <stdio.h>
#define F for(i=0;i<n;i++){
int i,j,n,v,a[999];s(int n){F if(a[i]>a[i+1])return 0;}return 1;}void h(){F v=a[i];a[i]=a[j=rand()%n];a[j]=v;}}void b(){while(!s(n-1))h();}main(){while(scanf("%d",&a[n++])>0);b();F printf("%d\n",a[i]);}}

(using globals instead of function args).

R, 82 characters
Since I wrote it for this question I thought I'll add it there as well. Slightly modified here to accomodate question criteria.
b=function(a){while(any(apply(embed(a,2),1,function(x)x[1]<x[2]))){a=sample(a)};a}

JavaScript (using Array.sort()): 91
Utilising Array.sort():
function s(a){while((a=a.sort(function(){return 2-Math.random()*4|0}))!=a.sort());return a}

JavaScript (avoiding Array.sort()): 186
Not using the built-in .sort() method (randomising method stolen from here):
function s(a){while(function(b,c,d){for(;c<b.length-1;){d&=b[c]<=b[++c]}return!d}(function(t,n,i){i=a.length;while(i--){n=Math.random()*i|0,t=a[i],a[i]=a[n],a[n]=t}}()||a,0,1));return a}

Java - 207 bytes
boolean sorted(Integer[] n,int i){while(i-->1)if(n[i]<n[i-1])return false;return true;}void bogo(Integer[] n){List<Integer>l=Arrays.asList(n);while(!sorted(n,n.length)){Collections.shuffle(l);l.toArray(n);}}

Ungolfed try online
boolean sorted(Integer[] n,int i)
{
    while(i --> 1) // i..1
        if(n[i] < n[i-1]) // ascending order
            return false;

    return true;
}

void bogo(Integer[] n)
{
    List<Integer>l = Arrays.asList(n);

    while(!sorted(n, n.length))
    {
        Collections.shuffle(l); // shuffle
        l.toArray(n); // re-fill the array
    }
}

Java, 147 bytes
import java.util.*;void A(List<Long>b){for(;;){for(int B=1;B++<b.toArray().length;){if(b.get(B-1)>b.get(B))break;return;}Collections.shuffle(b);}}

This sorts in ascending order, To make it sort in descending order, simply replace b.get(B-1)>b.get(B) with b.get(B-1)<b.get(B).
Ungolfed:
import java.util.*;

void A(List<Long> b) {
    for (;;) {
        for (int B = 1; B++ < b.toArray().length;) {
            if (b.get(B - 1) > b.get(B))
                break;
            return;
        }
        Collections.shuffle(b);
    }
}

Making this function compilable costs 9 bytes, resulting in a 156-byte program:
import java.util.*;class a{void A(List<Long>b){for(;;){for(int B=1;B++<b.toArray().length;){if(b.get(B-1)>b.get(B))break;return;}Collections.shuffle(b);}}}

Java (lambda expression), 111 bytes
(b,B)->{for(;;){for(B=1;B++<b.toArray().length;){if(b.get(B-1)>b.get(B))break;return;}Collections.shuffle(b);}}

This is a java.util.function.BiConsumer<java.util.List<Long>, Integer>.

C, 111 bytes
This answer takes bogus sort one step further: It doesn't shuffle the entire array before rechecking, it just makes a singe random swap before rechecking. For extra measure, that single random swap always swaps with the first entry, so the general random swap actually takes two iterations. Inefficient, yes, but hey, it's bogus sort, and it saves one call to rand()!
#include<stdlib.h>
t,r;b(int*d,int s){r=rand()%s;t=*d;*d=d[r];d[r]=t;for(r=s-1;r--;)d[r]>d[r+1]&&(b(d,s),r=0);}

Note that since the mixing loop is implemented via recursion, this will crash for larger input arrays (= more than eight elements on my machine) due to stack exhaustion.
Ungolfed:
void b(int*data,int size){
    //First, swap random element with the first element.
    int randomIndex = rand()%size;
    int temp = *data;
    *data = data[randomIndex];
    data[randomIndex] = temp;

    //Check if array is sorted
    for(int i = size-1;i--;) {
        if(data[i]>data[i+1]) {
            //array is not sorted, start over
            b(data,size);
            i = 0;  //don't resume loop on return
        }
    }
}

Test with
int main(){
    int data[] = {8, 7, 6, 5, 4, 3, 2, 1};
    int size = sizeof(data)/sizeof(*data);
    for(int i = 0; i < size; i++) printf("%d ", data[i]);
    printf("\n");

    b(data, size);

    for(i = 0; i < size; i++) printf("%d ", data[i]);
    printf("\n");
}

SmileBASIC, 104 81 bytes
DEF B A@D
SWAP A[0],A[RND(LEN(A))]FOR I=0TO LEN(A)-2IF A[I]<A[I+1]GOTO@D
NEXT
END

05AB1E, 6 bytes
œ.ΔD{Q

Try it online!
Explanation
œ       Create list with all permutations
 .Δ     Return the first element that satisfies the followng:
   D{Q  Check if element is sorted.

Pyth, 13 11 bytes
WnSQKO.pQ;K

Previous Solution
L?n.SbSbybb
y

Try it online!
WnSQKO.pQ;K
      .pQ    Generate a list of all permutations of input
    KO.pQ    K = random permutation in the list
WnSQK    ;   While(sorted(input) != K): do nothing
          K  print K

Previous Solution:
Compiled to python:
assign('Q',eval_input())
@memoized
def subsets(b):
 return (subsets(b) if ne(shuffle(b),Psorted(b)) else b)
imp_print(subsets(Q))

Basically:
Shuffle the list, if it isn't equal to the sorted list:
recursively call.
Else:
Return it

Husk, 8 bytes
ΩS=O§!←P

Try it online!
Husk does not have random numbers, so this uses the array itself to get a permutation. I genuinely don't know whether this would complete.
Explanation
ΩS=O§!←P
Ω        Until
 S=O     the argument is ordered
       P take it's permutations
      ←  take its first element
    §!   return that permutation

Given that it looks like the §!←P part just returns the list as is (as the permutations returned always has the original list as the first element), this will only finish if the list is inputted sorted

CJam, 14 bytes
{{__$=!}{mr}w}

Try it online!


text:
Forecast the weather
Write the shortest program to forecast the weather for the next 7 days
The input (from stdin) is the weekday and the season
The output (to stdout) is seven lines weekday and the temperature in centigrade
The weekdays begin on the input weekday
The temperatures are random numbers with the range depending on the season

Spring 10 - 30 degrees
Summer 20 - 40 degrees
Autumn  5 - 25 degrees  (Fall is a synonym for autumn)
Winter -5 - 15 degrees

Sample Input
Thursday Winter
Sample Output

Thursday -1
Friday 3
Saturday 8
Sunday 7
Monday 10
Tuesday 10
Wednesday -1

Your program must not have identical output every time it is run with the same input

Is it sufficient that only one day has random temperatures?
This way, the output won't be identical for each run.

Ive been thinking about tagging issues and would suggest that this a [tag:simulation] of a whether forecast.

@hallvabo, I don't intend to add any extra conditions to the question, it is what it is :)

FWIW: At least from the standpoint of my solution it's far easier to just generate random temperatures for each day than just for a single one. Handling all days the same is far easier and better to golf.

Is this a joke?

Ruby 1.8, 95 characters
#!ruby -nrdate
7.times{|i|puts (Date.parse($_)+i).strftime"%A #{"\023\004\016\016\035"[$_[-3]%5]-9+rand(21)}"}

The character escapes inside the string should be replaced by the character literals they represent.

Found a shorter way to pack the data, Ruby 1.9 would be 4 characters longer now (add .ord after $_[-3]).
112 -> 105 by stealing Joey's idea of not splitting the input.
105 -> 101. Note that the first line is actually parsed by the Ruby interpreter itself, so it even works when running the solution like echo "Thursday Winter" | ruby1.8 forecast.rb
101 -> 96. Stole Joey's idea again to just embed the temperatures into a string instead of an array.
Whoops, just noticed it should be rand(21), not rand(20).
96 -> 95. Removed unnecessary whitespace.

Windows PowerShell, 104
[dayofweek]$d,$s=-split$input
(0..6*2)[+$d..(6+$d)]|%{''+[dayofweek]$_,((random 20)-5+'☼

↓'[$s[3]%5])}

The strings in there are a bit icky, so a hex view for your convenience:
000: 5B 64 61 79 6F 66 77 65 │ 65 6B 5D 24 64 2C 24 73  [dayofweek]$d,$s
010: 3D 2D 73 70 6C 69 74 24 │ 69 6E 70 75 74 0A 28 30  =-split$input◙(0
020: 2E 2E 36 2A 32 29 5B 2B │ 24 64 2E 2E 28 36 2B 24  ..6*2)[+$d..(6+$
030: 64 29 5D 7C 25 7B 27 27 │ 2B 5B 64 61 79 6F 66 77  d)]|%{''+[dayofw
040: 65 65 6B 5D 24 5F 2C 28 │ 28 72 61 6E 64 6F 6D 20  eek]$_,((random
050: 32 30 29 2D 35 2B 27 0F │ 00 0A 0A 19 27 5B 24 73  20)-5+'☼ ◙◙↓'[$s
060: 5B 33 5D 25 35 5D 29 7D │                          [3]%5])}

History:

2011-02-04 00:16 (179) – First, straightforward attempt.
2011-02-04 00:20 (155) – Why match whole season names when you can get away with individual characters and a regex match? Won't deal nicely with invalid input but that's always to be expected in Golfing.
2011-02-06 13:12 (149) – Got rid of $t which only lengthened things.
2011-02-10 22:50 (142) – Day name generation made simpler. I just generate a week twice, index in the correct position and pull out seven items.
2011-02-10 22:52 (138) – Moving the initial cast to the declaration of $d saves a few bytes as well – and gets rid of $x.
2011-02-10 23:03 (135) – Moving the cast further down the pipeline to avoid an array cast (which needs additional []). Also changed output to casting a list of objects to string which implicitly inserts a space ($OFS default).
2011-02-11 20:54 (132) – Replaced the regex match by a list of character codes and indexing into a hashmap with the third character from the season.
2011-02-11 21:00 (122) – Replaced the hash map by an array.
2011-02-11 21:12 (117) – More array-y goodness. And shorter to boot. Modulo 8 packs the array a bit shorter.
2011-02-11 21:16 (116) – Extracted a factor of five to replace 0,0,2 by 0..2 which is shorter.
2011-02-11 21:22 (114) – Used a slightly different calculation. It still maps autumn and fall to the same index and has the advantage of only requiring five values. Very nice. The negative index into the string also plays very well with »Fall« being shorter than the rest.
2011-02-11 21:45 (112) – Stolen Ventero's way of determining the season's temperature range which is two bytes shorter.
2011-02-12 03:16 (105) – Back to 105 after a different attempt just printed a single line.
2011-02-12 13:23 (104) – Back to 104 again, using a positive index into the season since I split again.

Test script (as long as it outputs nothing the result is ok):
foreach ($d in 'Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday') {
    foreach ($s in 'Winter','Summer','Spring','Autumn','Fall') {
        $o=-split("$d $s"|./weather_foo.ps1)
        if ($o.Count -ne 14) { "Wrong output length" }
        $days = $o -notmatch '\d'
        $temps = $o -match '\d'
        if ($days[0]-ne$d) { "Found "+ $days[0] + " instead of $d" }
        $m = $temps | measure -min -max
        switch ($s) {
            'Summer'{ $min = 20 }
            'Spring'{ $min = 10 }
            'Fall'  { $min = 5  }
            'Autumn'{ $min = 5  }
            'Winter'{ $min = -5 }
        }

        if ($m.Minimum -lt $min) { "Minimum temperature $($m.Minimum) didn't match for $s" }
        if ($m.Maximum -gt $min + 20) { "Maximum temperature $($m.Maximum) didn't match for $s" }
    }
}

Golfscript - 110 chars
' ':^/){*}*43845%7&5*:|;){*}*333121%7&:$;7,{($+'Sun Mon Tues Wednes Thurs Fri Satur'^/.+='day '+20rand|+5-+n}/

Fully support all the temperature ranges, seasons and also support "Fall" as synonym for "Autumn" too.
I think there is some rooms for improvement, but my current golfscript knowledge is limited so far.

Here is the tests, 2 passes each to confirm randomness
$ echo -n Thursday Spring | gs codegolf-404.gs
Thursday 23
Friday 28
Saturday 25
Sunday 22
Monday 19
Tuesday 14
Wednesday 25

$ echo -n Thursday Spring | gs codegolf-404.gs
Thursday 27
Friday 12
Saturday 26
Sunday 12
Monday 27
Tuesday 17
Wednesday 21

$ echo -n Friday Autumn | gs codegolf-404.gs
Friday 10
Saturday 5
Sunday 17
Monday 24
Tuesday 24
Wednesday 12
Thursday 18

$ echo -n Friday Autumn | gs codegolf-404.gs
Friday 13
Saturday 7
Sunday 14
Monday 6
Tuesday 14
Wednesday 21
Thursday 5

$ echo -n Sunday Summer | gs codegolf-404.gs
Sunday 39
Monday 31
Tuesday 35
Wednesday 34
Thursday 21
Friday 36
Saturday 28

$ echo -n Sunday Summer | gs codegolf-404.gs
Sunday 34
Monday 20
Tuesday 30
Wednesday 39
Thursday 30
Friday 31
Saturday 37

$ echo -n Monday Fall | gs codegolf-404.gs
Monday 6
Tuesday 7
Wednesday 18
Thursday 13
Friday 7
Saturday 5
Sunday 14

$ echo -n Monday Fall | gs codegolf-404.gs
Monday 16
Tuesday 22
Wednesday 19
Thursday 23
Friday 21
Saturday 9
Sunday 17

$ echo -n Saturday Winter | gs codegolf-404.gs
Saturday 0
Sunday -5
Monday 10
Tuesday -3
Wednesday -5
Thursday 13
Friday -1

$ echo -n Saturday Winter | gs codegolf-404.gs
Saturday -4
Sunday 13
Monday 11
Tuesday 0
Wednesday 0
Thursday -5
Friday 9

$ echo -n Tuesday Summer | gs codegolf-404.gs
Tuesday 38
Wednesday 29
Thursday 25
Friday 29
Saturday 34
Sunday 20
Monday 39

$ echo -n Tuesday Summer | gs codegolf-404.gs
Tuesday 33
Wednesday 26
Thursday 31
Friday 37
Saturday 39
Sunday 24
Monday 28

$ echo -n Wednesday Winter | gs codegolf-404.gs
W    ednesday 7
Thursday 12
Friday 0
Saturday -3
Sunday 11
Monday 14
Tuesday 8

$ echo -n Wednesday Winter | gs codegolf-404.gs
Wednesday 0
Thursday -1
Friday 7
Saturday 12
Sunday -5
Monday -3
Tuesday 2

D: 436 Characters
import std.algorithm, std.random, std.range, std.stdio, std.typecons;

void main(string[] g)
{
    alias canFind w;
    alias tuple t;

    auto s = g[2];
    auto e = w(s, "g") ? t(10, 30) : w(s, "Su") ? t(20, 40) : w(s, "W") ? t(-5, 15) : t(5, 25) ;
    auto r = rndGen();

    int v()
    {
        r.popFront();
        return e[0] + cast(int)(r.front % (e[1] - e[0]));
    }

    auto x = findSplitBefore(["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], [g[1]]);

    foreach(q; chain(x[1], x[0]))
        writefln("%s %s", q, v());
}

Version with extraneous whitespace removed (which is how it comes to 436 characters):
import std.algorithm,std.random,std.range,std.stdio,std.typecons;void main(string[] g){alias canFind w;alias tuple t;auto s=g[2];auto e=w(s,"g")?t(10,30):w(s,"Su")?t(20,40):w(s,"W")?t(-5,15):t(5,25);auto r=rndGen();int v(){r.popFront();return e[0]+cast(int)(r.front%(e[1]-e[0]));}auto x=findSplitBefore(["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],[g[1]]);foreach(q;chain(x[1],x[0]))writefln("%s %s",q,v());}

Surely, you can save a lot of characters just by squeezing all the newlines and indentation, and most of the other spaces, out? ;-)

I counted the characters with all of the extra whitespace removed. It's just so hard to read that way that it seemed silly to post it that way.

PHP, 353 319 305 304 288 characters
<?$i=split(" ",fgets(STDIN));$d=$i[0][0].$i[0][1];$s=$i[1][2];$r=json_decode('{"i":[10,30],"m":[20,40],"t":[5,25],"n":[-5,15]}',true);$n=array(Sun,Mon,Tues,Wednes,Thurs,Fri,Satur);$z=$x=0;while($z<7)if($n[++$x][0].$n[$x][1]==$d||$z){$z++;echo$n[$x%7]."day ".rand($r[$s][0],$r[$s][1])."
";}

Ungolfed
<?php
    $input = fgets(STDIN);
    $info = split(" ", $input);
    $day = substr($info[0], 0, 2);
    $season = $info[1][2];
    $range[i][] = 10;
    $range[i][] = 30;
    $range[m][] = 20;
    $range[m][] = 40;
    $range[t][] = 5;
    $range[t][] = 25;
    $range[n][] = -5;
    $range[n][] = 15;
    $days[0] = "Sun";
    $days[1] = "Mon";
    $days[2] = "Tues";
    $days[3] = "Wednes";
    $days[4] = "Thurs";
    $days[5] = "Fri";
    $days[6] = "Satur";

    $i = $d = 0;

    while($i<7)
        if(substr($days[++$d], 0, 2)==$day||$i){
            $i++;
            echo $days[$d%7]."day ".rand($range[$season][0], $range[$season][1])."\n";
        }
?>

305 -> 304: Switched the newline
304 -> 288: Uses JSON arrays instead of PHP arrays

Does not accept Fall as a synonym for Autumn as specified in the task description.

C# 350 Characters
There must be a more efficient way than this. But here's what I've got so far:
using System;class P{static void Main(string[]x){var r=new Random();var s=x[1][2];int l=s=='r'?10:s=='m'?20:s=='n'?-5:5,u=s=='r'?31:s=='m'?41:s=='n'?16:26,i=0,z=(int)Enum.Parse(typeof(DayOfWeek),x[0]);for(;i<7;i++){var d=z<1?"Sun":z<2?"Mon":z<3?"Tues":z<4?"Wednes":z<5?"Thurs":z<6?"Fri":"Satur";Console.WriteLine(d+"day "+r.Next(l,u));z=z>5?0:z+1;}}}

Or in a more readable format, with a couple of comments:
using System;
class P
{
    static void Main(string[] x)
    {
        var r = new Random();
        var s = x[1][2]; //3rd char of season, first where all have unique letter

   // lower & upper limits for random, based on season
        int l = s == 'r' ? 10 : s == 'm' ? 20 : s == 'n' ? -5 : 5,
            u = s == 'r' ? 31 : s == 'm' ? 41 : s == 'n' ? 16 : 26,
            i = 0,
   // this line makes me cringe, but converting to an int and back seems
   // the easiest way to loop through days
            z = (int)Enum.Parse(typeof(DayOfWeek), x[0]);

        for (; i < 7; i++)
        {
            var d = z < 1 ? "Sun" : z < 2 ? "Mon" : z < 3 ? "Tues" : z < 4 ? "Wednes" : z < 5 ? "Thurs" : z < 6 ? "Fri" : "Satur";
            Console.WriteLine(d + "day " + r.Next(l, u));
            z = z > 5 ? 0 : z + 1; // increments day, resets to 0 after saturday
        }
    }
}

C# usually needs all the help it can get, so you can replace the contents of your for loop with this (I think):    Console.WriteLine(Enum.GetName(typeof(DayOfWeek), z++ % 7) + " " + r.Next(l, u));

Javascript - 251 chars
d=['Mon','Tues','Wednes','Thurs','Fri','Satur','Sun'],g=function(c){return Math.random()*21+c|0},p=prompt();for(i=0,j=7,t=true;i<j;i++){t=t&&p.indexOf(d[i])!=0;t?j++:console.log(d[i>6?i-7:i]+'day '+g(/mm/.test(p)?20:/g/.test(p)?10:/te/.test(p)?-5:5))}

Unfortunately the script does not meet the stdin/stdout requirement but it accepts Fall as a synonym for Autumn.
Whitespaced:
  d = [
    'Mon'
  , 'Tues'
  , 'Wednes'
  , 'Thurs'
  , 'Fri'
  , 'Satur'
  , 'Sun'
  ]
, g = function(c) {
    return Math.random()*21+c|0
  }
, p = prompt()

  ;

  for(i = 0, j = 7, t = true; i < j; i++) {
    t = t && p.indexOf(d[i]) != 0;
    t ?
      j++ :
      console.log(d[i > 6 ? i - 7 : i] + 'day ' + g(/mm/.test(p) ?
                                                      20 :
                                                    /g/.test(p) ?
                                                      10 :
                                                    /te/.test(p) ?
                                                      -5 :
                                                      5
                                                    )
                  )
  }

PHP - 150 Characters
<?$t=array("m"=>15,"r"=>5,"n"=>-10);for($a=split(" ",fgets(STDIN));$i<7;$i++)echo date("l ",strtotime($a[0]."+$i day")),rand(5,25)+$t[$a[1][2]],"\n";

I figured I'd write my own PHP solution after the current one doesn't even fully satisfy the challenge conditions.
It relies on strtotime to parse the day, and date to echo it back. To determine the season, it follows the third letter of the season name, which is unique (as given).
To run properly, it requires notices to be disabled and short tags to be enabled.

Python 2, 220 characters
A little large but (almost) readable.
import random
c,e=raw_input().split()
a=[d+'day'for d in'Mon Tues Wednes Thurs Fri Satur Sun'.split()]*2
x='rmtn'.index(e[2])*2
g=(10,30,20,40,5,25,-5,15)[x:x+2]
f=a.index(c)
for b in a[f:f+7]:
 print b,random.randint(*g)

Output
# echo "Monday Summer" | python forecast.py
Monday 33
Tuesday 29
Wednesday 33
Thursday 28
Friday 25
Saturday 21
Sunday 30

Mathematica 218
s_~g~d_ :=
Grid@RotateLeft[r = Thread@{DateString[{2012, 1, #}, {"DayName"}] & /@ Range@7,
  RandomInteger[Cases[{{"Spring", {10, 30}}, {"Summer", {20, 40}}, {"Autumn", {5, 25}},
  {"Winter", {-5, 15}}}, {s, _}][[1, 2]], 7]}, Position[r, d][[1, 1]] - 1]

Usage
g["Winter", "Sunday"]

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/2.5/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
Split a word into parts with equal scores
Assuming A=1, B=2... Z=26, and the value of a word is the sum of these letter values, it is possible to split some words into two pieces such that they have equal values.
For example, "wordsplit" can be broken into two pieces like so: ordsl wpit, because o+r+d+s+l = w+p+i+t.
This was a challenge given to us by my computing teacher - it is an old Lionhead Studios challenge, apparently. I have solved it in Python, and will post my answer shortly.
Challenge: The shortest program which can list all the possible splits which have equal scores. Note that it only has to list one for each group of letters - ordsl wpit is the same as rdosl wtip, for example. It is easier to list them in the order they come in the word.
Bonus:

If you highlight pairs where both words are valid English words (or some permutation of the letters is), using a word list of some kind. (This could be done by placing an asterisk next to each or some other method, but make it clear.)
Adding the option for removing duplicates (this should not be the default.)
Supporting more than two splits, for example, three, four or even n-way splits.

Must the program support mixed case input?  And if so can it discard the case for the output?

@Nemo157 It may ignore case and does not have to preserve it on the output.

Can the program output extra stuff, as long as what the requested part of the output is is clear to a human?

@J B Yes it can.

ok, I'll improve that Perl then ;) Thanks

Perl, 115 118 123
@_=~/./g;for$i(1..1<<@_){$l=$
r;$i&1<<$_?$l:$r+=64-ord$_[$_
]for 0..$#_;$l-$r||$i&1<<$_&&
print$_[$_]for 0..$#_;say""}

Run with perl -nE '<code goes here>'. That 'n' is counted in the code size.
Respaced:
@_ = /./g;
for $i (1 .. 1<<@_) {
  $l = $r;
  $i & 1<<$_ ? $l : $r -= 64 - ord $_[$_] for 0 .. $#_;

  $l - $r      ||
  $i & 1<<$_   &&
  print $_[$_]
    for 0 .. $#_;

  say ""
}

With comments and variable names:
# split a line of input by character
@chars = /./g;

# generate all binary masks of same length
for $mask (1 .. 1<<@_) {

  # start at "zero"
  $left_sum = $right_sum;

  # depending on mask, choose left or right count
  # 1 -> char goes left; 0 -> char goes right
  $mask & 1<<$_ ? $left_sum : $right_sum
    -= 64 - ord $chars[$_]   # add letter value
      for 0 .. $#chars;      # for all bits in mask

  # if left = right
  $left_sum - $right_sum ||

  # if character was counted left (mask[i] = 1)
  $mask & 1<<$_          &&

  # print it
  print $chars[$_]

  # ...iterating on all bits in mask
    for 0 .. $#chars;

  # newline
  say ""
}

Some of the tricks used:

1..1<<@_ covers the same bit range as 0..(1<<@_)-1 , but is shorter. (note that considering the problem from further away, including the range boundaries multiple times wouldn't result in a wrong output anyway)
$left_range and $right_range aren't reset to actual "0" numeric zero: since we just accumulate and compare them in the end, all we need is them to start at the same value.
subtracting 64-ord$_[$_] instead of adding ord$_[$_]-64 wins an invisible character: since it ends with a delimiter, it makes the space before for unnecessary.
Perl lets you assign to a variable determined by the ternary conditional operator: cond ? var1 : var2 = new_value.
boolean expressions chained with && and || are used instead of proper conditionals.
$l-$r is shorter than $l!=$r
will output a newline even on splits that don't balance.  Empty lines are ok by the rules!  I asked!

Care to explain for those of us who don't speak line noise? It looks like your using a binary mask approach similar to mine, and I see the 64 means '@' = 'A' - 1, and after that I'm pretty much lost.

Is this edit any better?

Nice. I need to think about taking advantage of the the add each count to the left or the right sum thing. Should have been obvious, but I missed it.

J (109)
~.(/:{[)@:{&a.@(96&+)&.>>(>@(=/@:(+/"1&>)&.>)#[),}.@(split~&.>i.@#@>)@<@(96-~a.&i.)"1([{~(i.@!A.i.)@#)1!:1[1

Output for wordsplit:

┌─────┬─────┐
│lorw │dipst│
├─────┼─────┤
│diltw│oprs │
├─────┼─────┤
│iptw │dlors│
├─────┼─────┤
│dlors│iptw │
├─────┼─────┤
│oprs │diltw│
├─────┼─────┤
│dipst│lorw │
└─────┴─────┘

Explanation:

1!:1[1: read a line from stdin
([{~(i.@!A.i.)@#): get all permutations
"1: for each permutation:
(96-~a.&i.): get letter scores
}.@(split~&.>i.@#@>)@<: split each permutation of the scores at each possible space, except before the first and after the last number
>(>@(=/@:(+/"1&>)&.>)#[): see which permutations have matching halves and select these
{&a.@(96&+)&.>: turn the scores back into letters
~.(/:{[): remove trivial variations (e.g. ordsl wpit and ordsl wpti)

Some of your answers are duplicates.

@DavidCarraher: Well, either I'm blind or this one isn't, nor are my recent answers. I've never copied other people's answers on purpose, though you could of course be right, I've posted here while drunk sometimes and not remembered until I got loads of downvotes and it turned out I'd submitted something that wasn't even close to correct. If you've seen me misbehave, maybe leave the comment where I'm misbehaving, then I will delete any offending answers; or maybe downvote them as that's what downvotes are for.

No slight was intended.  I simply meant, for example, that your first answer, {"lorw", "dipst"} is a duplicate of your final answer, {"dipst","lorw"}. Only the order of the words is different.

@DavidCarraher: whoops :P I thought you meant I'd copied someone's answer... anyway this question says (if I've interpreted it right) to remove the duplicates where the individual parts are just permutations of each other, but not to remove the ones where the order of the parts is different, i.e if {a,bc} is already found, to remove {a,cb} but not to remove {bc,a}. (And of course I'm not offended, if I actually /had/ duplicated someone's answer I'd prefer it if someone pointed it out.)

You seem to be right. The instructions say that it's ok to ignore order of words ("Note that it only has to list one for each group of letters"), but they do not require it. This may save me a few characters. Thanks.

c99 -- 379 necessary characters
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int s(char*w,int l,int m){int b,t=0;for(b=0;b<l;++b){t+=(m&1<<b)?toupper(w[b])-64:0;}return t;}
void p(char*w,int l,int m){for(int b=0;b<l;++b){putchar((m&1<<b)?w[b]:32);}}
int main(){char w[99];gets(w);int i,l=strlen(w),m=(1<<l),t=s(w,l,m-1);
for(i=0;i<m;i++){if(s(w,l,i)==t/2){p(w,l,i);putchar(9);p(w,l,~i);putchar(10);}}}

The approach is pretty obvious. There is a function which sums a words according to a mask and one that prints it also according to a mask. Input from the standard input. One oddity is that the printing routine inserts spaces for letter not in the mask. A tab is used to separate the groups.
I do none of the bonus items, nor is it easily converted to support them.
Readable and commented:
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int s(char *w, int l, int m){ /* word, length, mask */
  int b,t=0;                  /* bit and total */
  for (b=0; b<l; ++b){
/*     printf("Summing %d %d %c %d\n",b,m&(1<<b),w[b],toupper(w[b])-'A'-1); */
    t+=(m&1<<b)?toupper(w[b])-64:0; /* Add to toal if masked (A-1 = @ = 64) */
  }
  return t;
}
void p(char *w, int l, int m){
  for (int b=0; b<l; ++b){
    putchar((m&1<<b)?w[b]:32);  /* print if masked (space = 32) */
  }
}
int main(){
  char w[99];
  gets(w);
  int i,l=strlen(w),m=(1<<l),t=s(w,l,m-1);
/*   printf("Word is '%s'\n",w); */
/*   printf("...length %d\n",l); */
/*   printf("...mask   0x%x\n",m-1); */
/*   printf("...total  %d\n",t); */
  for (i=0; i<m; i++){
/*     printf("testing with mask 0x%x...\n",i); */
    if (s(w,l,i)==t/2) {p(w,l,i); putchar(9); p(w,l,~i); putchar(10);}
    /* (tab = 9; newline = 10) */
  }
}

Validation
 $ wc wordsplit_golf.c
  7  24 385 wordsplit_golf.c
 $ gcc -std=c99 wordsplit_golf.c
 $ echo wordsplit | ./a.out
warning: this program uses gets(), which is unsafe.
 or sp          w  d  lit
wor   l            dsp it
 ords l         w    p it
w    p it        ords l
   dsp it       wor   l
w  d  lit        or sp

Ruby: 125 characters
r=->a{a.reduce(0){|t,c|t+=c.ord-96}}
f=r[w=gets.chomp.chars]
w.size.times{|n|w.combination(n).map{|s|p([s,w-s])if r[s]*2==f}}

Sample run:
bash-4.2$ ruby -e 'r=->a{a.reduce(0){|t,c|t+=c.ord-96}};f=r[w=gets.chomp.chars.to_a];w.size.times{|p|w.combination(p).map{|q|p([q,w-q])if r[q]*2==f}}' <<< 'wordsplit'
[["w", "o", "r", "l"], ["d", "s", "p", "i", "t"]]
[["w", "p", "i", "t"], ["o", "r", "d", "s", "l"]]
[["o", "r", "s", "p"], ["w", "d", "l", "i", "t"]]
[["w", "d", "l", "i", "t"], ["o", "r", "s", "p"]]
[["o", "r", "d", "s", "l"], ["w", "p", "i", "t"]]
[["d", "s", "p", "i", "t"], ["w", "o", "r", "l"]]

Mathematica 123 111
Finds all subsets of word that have 1/2 the "ascii total" of the word, d. Then finds the complements of those subsets.
d = "WORDSPLIT"
{#, Complement[w, #]}&/@Cases[Subsets@#,x_/;Tr@x==Tr@#/2]&[Sort[ToCharacterCode@d - 64]];
FromCharacterCode[# + 64] & /@ %

{{"IPTW", "DLORS"}, {"LORW", "DIPST"}, {"OPRS", "DILTW"}, {"DILTW",
    "OPRS"}, {"DIPST", "LORW"}, {"DLORS", "IPTW"}}

J, 66 chars
Using digits of base2 numbers to select every possible subset.
   f=.3 :'(;~y&-.)"{y#~a#~(=|.)+/"1((+32*0&>)96-~a.i.y)#~a=.#:i.2^#y'
   f 'WordSplit'
┌─────┬─────┐
│Worl │dSpit│
├─────┼─────┤
│Wdlit│orSp │
├─────┼─────┤
│Wpit │ordSl│
├─────┼─────┤
│ordSl│Wpit │
├─────┼─────┤
│orSp │Wdlit│
├─────┼─────┤
│dSpit│Worl │
└─────┴─────┘

My solution is below. It is an almost anti-golf in its size, but it works very well. It supports n-way splits (although computational time becomes very long for any more than about 3 splits) and it supports removing duplicates.
class WordSplitChecker(object):
    def __init__(self, word, splits=2):
        if len(word) == 0:
            raise ValueError, "word too short!"
        if splits == 0:
            raise ValueError, "splits must be > 1; it is impossible to split a word into zero groups"
        self.word = word
        self.splits = splits

    def solve(self, uniq_solutions=False, progress_notifier=True):
        """To solve this problem, we first need to consider all the possible
        rearrangements of a string into two (or more) groups.

        It turns out that this reduces simply to a base-N counting algorithm,
        each digit coding for which group the letter goes into. Obviously
        the longer the word the more digits needed to count up to, so
        computation time is very long for larger bases and longer words. It
        could be sped up by using a precalculated array of numbers in the
        required base, but this requires more memory. (Space-time tradeoff.)

        A progress notifier may be set. If True, the default notifier is used,
        if None, no notifier is used, and if it points to another callable,
        that is used. The callable must take the arguments as (n, count,
        solutions) where n is the number of iterations, count is the total
        iteration count and solutions is the length of the solutions list. The
        progress notifier is called at the beginning, on every 1000th iteration,
        and at the end.

        Returns a list of possible splits. If there are no solutions, returns
        an empty list. Duplicate solutions are removed if the uniq_solutions
        parameter is True."""
        if progress_notifier == True:
           progress_notifier = self.progress
        solutions = []
        bucket = [0] * len(self.word)
        base_tuple = (self.splits,) * len(self.word)
        # The number of counts we need to do is given by: S^N,
        # where S = number of splits,
        #       N = length of word.
        counts = pow(self.splits, len(self.word))
        # xrange does not create a list in memory, so this will work with very
        # little additional memory.
        for i in xrange(counts):
            groups = self.split_word(self.word, self.splits, bucket)
            group_sums = map(self.score_string, groups)
            if len(set(group_sums)) == 1:
                solutions.append(tuple(groups))
            if callable(progress_notifier) and i % 1000 == 0:
                progress_notifier(i, counts, len(solutions))
            # Increment bucket after doing each group; we want to include the
            # null set (all zeroes.)
            bucket = self.bucket_counter(bucket, base_tuple)
        progress_notifier(i, counts, len(solutions))
        # Now we have computed our results we need to remove the results that
        # are symmetrical if uniq_solutions is True.
        if uniq_solutions:
            uniques = []
            # Sort each of the solutions and turn them into tuples.  Then we can
            # remove duplicates because they will all be in the same order.
            for sol in solutions:
                uniques.append(tuple(sorted(sol)))
            # Use sets to unique the solutions quickly instead of using our
            # own algorithm.
            uniques = list(set(uniques))
            return sorted(uniques)
        return sorted(solutions)

    def split_word(self, word, splits, bucket):
        """Split the word into groups. The digits in the bucket code for the
        groups in which each character goes in to. For example,

        LIONHEAD with a base of 2 and bucket of 00110100 gives two groups,
        "LIHAD" and "ONE"."""
        groups = [""] * splits
        for n in range(len(word)):
            groups[bucket[n]] += word[n]
        return groups

    def score_string(self, st):
        """Score and sum the letters in the string, A = 1, B = 2, ... Z = 26."""
        return sum(map(lambda x: ord(x) - 64, st.upper()))

    def bucket_counter(self, bucket, carry):
        """Simple bucket counting. Ex.: When passed a tuple (512, 512, 512)
        and a list [0, 0, 0] it increments each column in the list until
        it overflows, carrying the result over to the next column. This could
        be done with fancy bit shifting, but that wouldn't work with very
        large numbers. This should be fine up to huge numbers. Returns a new
        bucket and assigns the result to the passed list. Similar to most
        counting systems the MSB is on the right, however this is an
        implementation detail and may change in the future.

        Effectively, for a carry tuple of identical values, this implements a
        base-N numeral system, where N+1 is the value in the tuple."""
        if len(bucket) != len(carry):
            raise ValueError("bucket and carry lists must be the same size")
        # Increase the last column.
        bucket[-1] += 1
        # Carry numbers. Carry must be propagated by at least the size of the
        # carry list.
        for i in range(len(carry)):
            for coln, col in enumerate(bucket[:]):
                if col >= carry[coln]:
                    # Reset this column, carry the result over to the next.
                    bucket[coln] = 0
                    bucket[coln - 1] += 1
        return bucket

    def progress(self, n, counts, solutions):
        """Display the progress of the solve operation."""
        print "%d / %d (%.2f%%): %d solutions (non-unique)" % (n + 1, counts, (float(n + 1) / counts) * 100, solutions)

if __name__ == '__main__':
    word = raw_input('Enter word: ')
    groups = int(raw_input('Enter number of required groups: '))
    unique = raw_input('Unique results only? (enter Y or N): ').upper()
    if unique == 'Y':
        unique = True
    else:
        unique = False
    # Start solving.
    print "Start solving"
    ws = WordSplitChecker(word, groups)
    solutions = ws.solve(unique)
    if len(solutions) == 0:
        print "No solutions could be found."
    for solution in solutions:
        for group in solution:
            print group,
        print

Sample output:
Enter word: wordsplit
Enter number of required groups: 2
Unique results only? (enter Y or N): y
Start solving
1 / 512 (0.20%): 0 solutions (non-unique)
512 / 512 (100.00%): 6 solutions (non-unique)
dspit worl
ordsl wpit
orsp wdlit

In my opinion answers that admittedly make zero attempt at meeting the goal of the original question (code brevity) are effectively off-topic.  You admit that this answer has no relation to code-golf so rather than post it as an answer I'd suggest posting it somewhere else and putting a link to it in a comment on the question.

@Sugerman: It's a reference implementation, not an attempt to win the game. I prefer reference implementations as answers rather than taking up space at the top of the page, and I prefer them on-site to remove the risk of link rot.

@Sugerman: Why not submit it? It's better than nothing. It could be minimised, but why bother - I can't really accept my own question (well, I can, but it's not in the spirit of it.)

Because at the base of it, this is a Question & Answer site.  Something that is not intended as an answer should not be posted as such.

@Sugerman, How else would you suggest I share a working demo of it? Besides, I could shorten this. I just made no attempt at doing so because I couldn't win my own competition.

As I said in my first comment, I would've linked to it in a comment on the Question or since you own the Question edit the link in there.  There also nothing wrong with submitting an Answer to your own Question as long as you don't automatically accept your own Answer without considering all others (and voting results).

Lua - 195
a=io.read"*l"for i=0,2^#a/2-1 do z,l=0,""r=l for j=1,#a do b=math.floor(i/2^j*2)%2 z=(b*2-1)*(a:byte(j)-64)+z if b>0 then r=r..a:sub(j,j)else l=l..a:sub(j,j)end end if z==0 then print(l,r)end end

input must be in caps:
~$ lua wordsplit.lua
>WORDSPLIT
WDLIT   ORSP
DSPIT   WORL
WPIT    ORDSL

Python - 127
w=rawinput()
for q in range(2**len(w)/2):
 a=[0]*2;b=['']*2
 for c in w:a[q%2]+=ord(c)-96;b[q%2]+=c;q/=2
 if a[0]==a[1]:print b

and here a n-split Version with 182 bytes without duplicates:
n,w=input()
def b(q):
 a=[0]*n;b=['']*n
 for c in w:a[q%n]+=ord(c)-96;b[q%n]+=c;q/=n
 return a[0]==a[1] and all(b) and frozenset(b)
print set(filter(None,map(b,range(n**len(w)/n))))

Input is e.g.:
3, 'wordsplit'

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/2.5/


text:
Calculating areas.
The smallest code that gives the area between the curve p(x) = a0 + a1*x + a2*x2 + ..., the line y = 0, the line x = 0 and the line x = C
(i.e. something like this:
)
You can assume that p(x) >= 0 for x < C (bonus points if your code works for negative values of p(x)).
Input
C, a0, a1, ...
Output
a real number - the area
Example 1:
input: 2, 0, 1
output: 2.0

Examlpe 2:
input: 3.0, 0, 0.0, 2
output: 18

UPDATE:

C > 0 is also assumed
the area is between the curve, y=0, x=C and x = 0
the input can be a list of any form; not necessarily comma separated.
the output can be a real of any form (thus, '18' is a valid output, as is '18.0')

Since the answer is going to be "infinite" for almost any input, I think you've misstated the problem.

Should the input be read from standard input as a comma-separated string? Or can we write a function which takes a list of floats as an argument?

Do you mean between x=0, x=C, y=0, and the curve?

Can we assume that C > 0?

Also I assume that the output for the last case is supposed to be 18.0 or alternatively that it does not matter whether we add .0. Otherwise I do not understand why the first sample output ends in .0 and the second does not.

@Peter: I don't think so. He shows a picture of an inverse (the integral of which would diverge), but the function he specifies is a polynomial. The definite integral over [0,C) should be well defined and finite for finite coefficients.

@Peter: dmckee is right. I'll upload a more appropriate diagram later.

@sepp2k: list of floats is fine and yes C > 0 is assumed.

@Keith: yes, i forgot x=0.

@dmckee, I had noticed that, but my point was more that he was integrating a polynomial from -\infty to C, and for any non-trivial polynomial that diverges. The question has now been amended to fix this.

Can i accept the number of coefficients also in the input?

@AbelTom Well, formally not.

Mathematica: 48 Chars
.
Sum[#[[i+1]]#[[1]]^i/i,{i,Length@#-1}]&@Input[]

-1 byte: Length@# -> Tr[1^#]. Also, you could omit @Input[] and make a function.

APL (Dyalog Unicode), 9 bytes
⊃⊥∘⌽⊢÷⍳∘≢

Try it online!
A tacit function that takes C, a0, a1, ... as a single vector argument.
12 bytes if a full program is needed. Note that, while the default representation for a numeric vector is the numbers separated by spaces (no comma or anything), it accepts comma-separated ones since ⎕ evals the input and , is the "concatenate" function.
(⊃⊥∘⌽⊢÷⍳∘≢)⎕

Try it online!
Uses ⎕IO←0 and ⎕DIV←1, so that the range generation is 0-based and division by zero gives 0.
Because the polynomial is nonnegative and the integral starts at 0, it suffices to evaluate the antiderivative of the given polynomial at C.
The antiderivative of \$a_0 + a_1x + a_2x^2 + \dots\$ is \$a_0x + \frac{a_1}{2} x^2 + \frac{a_2}{3} x^3 + \dots\$. Because we have C attached to the start of the vector, we simply divide the entire array by their 0-based indexes:
       C  a0   a1   a2
input: 3  0    0    2
div  : 0  1    2    3
res  : 0  0    0    2/3
       0  a0/1 a1/2 a2/3

Then we simply evaluate the resulting polynomial at C.
How it works: the code
⊃⊥∘⌽⊢÷⍳∘≢  ⍝ Input: single array of C, a0, a1, a2, ...
      ⍳∘≢  ⍝ 0-based range 0, 1, 2, 3, ...
    ⊢÷     ⍝ Divide self by above
  ∘⌽       ⍝ Reverse
⊃⊥         ⍝ Convert from base C to real number
           ⍝ i.e. evaluate the polynomial, lowest term given last

Python - 71 63 chars:
a=input()
print sum(1.*a[i]*a[0]**i/i for i in range(1,len(a)))

It's a simple integration of a polynomial function between 0 and C.
And I haven't tested it, but I'm quite sure it works for negative values.

Learned something new about input() today:)

J, 26 characters
f=:3 :'((1}.y)&p.d._1)0{y'

e.g.
   f 2 0 1
2
   f 3 0 0 2
18

Neat!  I can't find a way to make it more tacit.  That d. being a conjunction doesn't make it very easy to my novice J skills.

@J-B: Yes, that d. is a "problem" for me too. :)

Haskell, 85 characters
f(c:l)=sum.map(\(i,x)->x*c**i/i)$zip[1..]l
main=getLine>>=print.f.read.('[':).(++"]")

The question isn't as strict as you treat it.  You could definitely simplify the input code, and possibly do away with explicit I/O altogether.

APL(NARS), 8 chars, 16 bytes
∘{⍵⊥⌽⍺}∫

The new NARS2000 function integrate, ∫.
it seems f∫b is integrate(f, 0..b)=∫_0^b f
Here i don't know if can be ok, the right argument is the max of interval of integration [0, max]
and the left argument is the list of numbers represent polinomy...
  f←∘{⍵⊥⌽⍺}∫
  0 1 f 2
2
  0 0 2 f 3
18
  1 2 3 4 5 6 f 7
137256

I don't know NARS, but if ∫ is a monadic operator and ∘ can bind two functions like Dyalog does, I guess {⊥∘⌽∘⍵∫⍺} could work at 9 chars.

@Bubbler so can be pheraps, less of 8 chars

Ruby, 65 chars
i=s=0
c=gets(q=",").to_f
$<.each(q){|a|s+=a.to_f*c**(i+=1)/i}
p s

The code reads until the end of input, not the end of the line. So you need to hit Ctrl+D to terminate input. (Pipe the input in using echo or from a file.)

i think assigning the "," to a variable will help...how about this c=gets(q=",").to_f and $<.each(q){|a|s+=a.to_f*c**(i+=1)/i}, saves one char....

Assigning "," (or ?,, which is even shorter) to $/ allows you to omit the argument to $<.each. And $<.map is one character shorter than $<.each. ;)

C  GCC 186 182 bytes
f(){i=0,l=1;float *d,s=0.0;d=malloc(sizeof(float)*50);scanf("%f",&d[0]);while(getchar()!='\n'){scanf("%f",&d[l]);l++;}for(i=0;i<l;i++)s+=d[i+1]*pow(d[0],(i+1))/(i+1);printf("%f",s);}

This program gives an output (area) for any curve between the curve, y=0, x=C and x=0. It can take coefficients (float as well) from a0 to a48. The first accepted input is C followed by coefficients. Press Ènter after the last coefficient.
void f()
{
  int i=0,l=1;
  float *d,s=0.0;
  const int sz=100;
  d=malloc(sizeof(float)*sz);

  scanf("%f",&d[0]);
  while(getchar()!='\n')
  {
    scanf("%f",&d[l]);
    l++;
  }

  for(i=0;i<l;i++)
    s+=d[i+1]*pow(d[0],(i+1))/(i+1);

   printf("%f",s);
}

Mathematica, 48 bytes
Try it online!
f[a_]:=Sum[a[[i+1]]*a[[1]]^i/i,{i,1,Length@a-1}]

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/