Generate any random integer Your program/function should


output exactly one integer
output any integer with positive probability
output an integer greater than 1.000.000 or less than -1.000.000 with at least with 50% probability.


Example outputs (all must be possible):

59875669123
12
-42
-4640055890
0
2014
12
24
-7190464664658648640055894646646586486400558904644646646586486400558904646649001


Clarifications:


A trailing line break is permitted.
Leading zeros aren't allowed.
-0 is permitted.


Shortest code wins.
Java, 133 149

void f(){String s=x(2)&lt;1?"-":"";for(s+=x(9)+1;x(50)&gt;0;s+=x(10));System.out.print(x(9)&lt;1?0:s);}int x(int i){return new java.util.Random().nextInt(i);}


Example outputs

-8288612864831065123773
0
660850844164689214
-92190983694570102879284616600593698307556468079819964903404819
3264


Ungolfed

void f() {
    String s = x(2)&lt;1 ? "-" : "";       // start with optional negative sign
    s+=x(9)+1;                          // add a random non-zero digit
    for(; x(50)&gt;0; )                    // with a 98% probability...
        s+=x(10)                        // append a random digit
    System.out.print(x(9)&lt;1 ? 0 : s);   // 10% chance of printing 0 instead
}

int x(int i) {
    return new java.util.Random().nextInt(i);
}


Old answer (before rule change)

void f(){if(Math.random()&lt;.5)System.out.print('-');do System.out.print(new java.util.Random().nextInt(10));while(Math.random()&gt;.02);}