g | x | w | all
Bytes Lang Time Link
034Zsh250223T092139Zroblogic
020Uiua250222T135608Znoodle p
043Python3.8.10220208T002616ZDaemiryo
019Rattle220206T194504Zd01
054Python 3220208T195846ZOliver
018<>^v220207T144644Zastroide
028APOL220207T134414ZGinger
032Julia 1.0220207T125800ZMarcMush
019Ly220207T044508Zcnamejj
013Vyxal O210514T091131Zemanresu
926Commodore C64/128190412T134010ZShaun Be
01205AB1E210514T155340ZMakonede
012Jelly210514T161319Zhyperneu
096PPL210514T085939Zuser1006
037MATLAB/Octave210514T075815Zelementi
028Befunge98 FBBI200624T205036ZPizgenal
020Microscript II190409T014235ZSuperJed
053C gcc190411T013758ZBenjamin
023Runic Enchantments190513T013432ZDraco18s
053Python190510T114430ZAlexande
049Python 2190510T110702ZArBo
098Java190508T143607ZBenjamin
033Octave190508T140059Zuser8690
048C# Visual C# Interactive Compiler190411T082814Zdana
015MathGolf190412T113121Zmaxb
038VB.Net190411T125457ZBenno
016Japt v1.4.5190411T030411Zdana
034Perl 6190411T031648Zbb94
036TIBASIC TI84+/SE190410T165031Zabsolute
037GNU Bash190411T023932ZGreg Nis
372JVM Bytecode noverify190410T131305ZCitty
051Forth gforth190409T202553Zreffu
105C++190408T214022ZHatsuPoi
01205AB1E190409T075513ZKevin Cr
040PowerShell190408T210305ZDBADon
064Tcl171116T232552Zsergiol
018J130215T070056Zrandomra
nan130212T120257ZGaffi
056Python130211T192600ZStephen
038Befunge130211T202643ZJoe K
020Dyalog APL 20 Charachters121127T200234ZMrZander
2428Ruby121125T225015Zknut
030R121202T173659Zflodel
077Python 56121207T223746ZLambda F
048Befunge121201T011500Zdaniero
030PHP121203T132956Zlll
040Javascript121203T134913Ztomsmedi
042EmacsLisp121202T194614Zdualinit
070Python121127T085725ZJoshua S
nan121128T160109Zfreewary
021GolfScript121130T135559ZIlmari K
036R121127T223253Zfreewary
039Groovy121127T164306ZWill Lp
149Java121128T064219ZNoah
nan121128T045345Zxxfelixx
406CMD Shell Win XP or later121127T213952ZSeanC
042Javascript121127T132848Zzaphod19
027vba121126T140002ZSeanC
062C121125T082207Zugoren
038PHP121125T134236Zprimo
096Python121124T110116Zgrc

Zsh, 34 bytes

((0/(RANDOM%6)))||<<<'i survived!'

Try it online!

Tested on MacOS and Linux.

Uiua, 20 bytes

&p"I survived!"◌°↥₁⚂₆

Try it: Uiua pad

Gets a random integer in 0..6, uses a pattern match to assert that it is greater than or equal to one, and prints the string. If the pattern match fails, the program immediately crashes.

Python3.8.10 : 45 43

int({*'12345 '}.pop());print('I survived!')

-2 bytes thanks to Enyobi

I hope it follows the challenge specification. I did some statistics with this method and it seems to have a uniform probability distribution (the program crashes 10416 times over 60000 calls from the console)

Rattle, 21 19 bytes

=?6/`p"I survived!"

Try it Online!

There's a 5/6 chance that this just prints I survived, and a 1/6 chance that this exits with an error:

Error: float division by zero at command index 1 [/`]

Explanation

=?6           sets the top of the stack to a random value from 0-5 inclusive
   /`         divides the top of the stack by the top of the stack. 
                  This works fine except for when the top of the stack is 0
     b"..."   adds "I survived!" to the output buffer, implicit output (p" " would work here too)

Python 3, 54 bytes

import random;1/random.randrange(5);print'I survived!'

On 1/0 it will crash:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ZeroDivisionError: integer division or modulo by zero

<>^v, 18 bytes

5#=V"I survived!";

run online

Explanation

5#=V"I survived!";
5                  Push 5 to stack
 #                 Push random number in range [0, <top of stack>]
  =                Skip next instruction if the top two elements (5 and the random number)
                   of the stack are equal
   V               Try reading the value of register 'v'. This should crash because it was
                   never assigned a value, its setter 'v' being a keyword
    "              String start
     I survived!   Contents of the string
                "  String end
                 ; Print with newline

APOL, 28 bytes

Dead simple, just uses the "divide by 0" method.

/(1 ∿(0 5));p("I survived!")

Julia 1.0, 32 bytes

0%rand(0:5);print("I survived!")

Try it online!

Ly, 19 bytes

6?/<"I survived!"&o

Try it online!

This is similar to some of the other entries. It generates a random number between 0 and 5, then crashes with a division by zero error if 0 was the result.

6?                   - generate a random number in 0-5
  /                  - divide, fails with division by zero 1/6 of the time
   <                 - switch to a clean stack
    "I survived!"    - push the output string (codepoints)
                 &o  - print the stack a characters

Vyxal O, 13 bytes

6ʁ℅ḭ`I ¦⟇d!`,

Try it Online!

Fixed thanks to Razetime!

When run offline, 11 bytes (thanks to Aaron Miller)

6ʁ℅ḭ`I ¦⟇d!

Try it Online!

Commodore C64/128, C64Mini and compatibles, 101 95 92 tokenised BASIC bytes + 6 penalty bytes for only working in Commodore BASIC

As Commodore keyword abbreviations, you may enter it as follows:

 0a$="i survived":fOi=0to5:a$(i)=a$:nE:a$(rN(.)*6)="":x=6*rN(.)
 1?len(a$(x))/len(a$(x))"{left}{left}"a$

I found a six-tokenised byte saving by not using the INT keyword when assigning a value with RND and CBM BASIC will automatically convert the key value to it's integer by ignoring the decimal places.

Non-obfuscated for explanatory purposes:

 0 let a$="i survived"
 1 for i=0 to 5
 2 let a$(i)=a$
 3 next i
 4 let a$(int(rnd(0)*6)=""
 5 let x=int(rnd(0)*6)
 6 print len(a$(x))/len(a$(x));"{left}{left}";a$(x)

Firstly, we set up a$ as a string and we later use it as an array; in Microsoft [Commodore] BASIC that appeared on the PET, VIC-20, C64 etc... you can set up the first 11 elements of a zero-indexed array without expressly declaring it first, though it saves space on the variable stack if you do and you have fewer than 11 elements.

So our string array of six elements are set to the string literal of i survived. One of those elements is randomly reset to an empty string.

The x variable is then used to select which of the six will be displayed (one of which is empty). Finally, we try to divide the length of that element with itself; usually this would produce an output of 1 except where the string length of the element is 0, so 0/0 will produce an error (one in six chance) and halt the execution of the symbolic listing; otherwise, the print command moves the cursor position back two spaces to overwrite the output with the string literal of the array element x, or i survived.

This answer assumes that the division by zero error reported by BASIC (which halts the programs execution by the interpreter) is acceptable as the program crashing as cited above.

Commodore 64 Russian Roulette

05AB1E, 12 bytes

Ties hyper-neutrino's Jelly answer for #1.

“IЖd!“6LΩiF

Try it online!

“...“6LΩiF  # trimmed program
“...“       # push "I survived!"
        i   # if...
       Ω    # random element in...
      L     # [1, 2, 3, ...,
     6      # ..., literal...
      L     # ]...
        i   # is 1...
         F  # then do nothing...
“...“       # "I survived!"...
         F  # times
            # implicit output

Jelly, 12 bytes

6X’’Xṛ“`:ƭ÷»

Try it online!

Explanation

6X            Generate a random number between 1 and 6 inclusive (using python randrange)
  ’’          Decrement it twice
    X         Generate a random number from 1 to the above value. 0 if the value is 0. Error if the value is negative (1/6 chance)
     ṛ        Right Argument; ignore the above value and instead return
      “`:ƭ÷»  "I survived!"

Unfortunately, taking the reciprocal of 0, dividing or integer-dividing by 0, and modulo by 0 all give either inf or nan, and don't actually error.

PPL, 96 bytes

importRandom
declarex=Random.random()*6
ifx>1{
printLine("I survived!")
}
ifx<=1{
printLine(f)
}

Very similar code to the Minceraft problem. Runs on PPL v1.0.10.

Soon, I will publish an official PPL website where you can create and run PPL code. I am still working on it.

Explanation

The first line imports Random.

Then, we set x to Random.random() (random float between 0 and 1) multiplied by 6.

Since neither else nor ternary exists in PPL, we must use two diverging if-statements. One prints the string I survived! to STDOUT (if x is greater than 1) while the other errors because f is undefined.

MATLAB/Octave, 37 bytes

a=1:5;a(randi(6));disp("I survived!")

Try it online!
It has 1 in 6 chances to crash with indexing error, when randi returns 6.

Befunge-98 (FBBI), 28 bytes

r?<?
"< <@,ka"I survived!
 =

Try it online!

Errors with a segmentation fault.

Explanation

Befunge-98 adds some extra features (r, k, and =) that can be used to further golf Joe K's Befunge-93 answer.

The first line (r?<?) calculates the 1/6 chance. The r initially reflects the IP to the left, where it reaches the second ? and goes in a random direction. If it goes right, the r reflects it and it tries again. If it goes up or down, it moves onto the second line, and if it goes left, it moves onto the first ?. There are three ways the IP can leave, so there is a 1/3 chance it moves onto the first ?. If it gets there, it again goes in a random direction. If it goes horizontally, it gets reflected (with either r or <) and tries again. This means that there are only two ways that the IP can leave, and they are equally likely. Either it goes down onto the second line, or it goes up and hits the = on the third line.

There is a 1/6 chance that = is executed (1/3 from the second ? times 1/2 from the first). If it is, it does a system-execute call on the stack (which is empty and interpreted as an empty string). FBBI's implementation of this runs a C system() call on the empty string, which segfaults.

This leaves a 5/6 chance that the IP reaches the second line. If it does, it gets sent left with <, and pushes the string "!devivrus I" onto the stack. ak, prints the top 11 characters of the stack, outputting I survived! Finally, @ ends the program.

Microscript II, 20 bytes

6R("I survived!"ph)f

Generates a random integer on [0,5], printing the message and halting if the generated integer is nonzero. If the generated integer is 0, it instead crashes with an IllegalArgumentException because the f instruction is invoked on a nonstring value

C (gcc), 58 53 bytes

-5 bytes by using &i in place of time(0) - thanks ceilingcat

Floating point exception when rand() is divisible by 6

main(i){i/=(srand(&i)+rand()%6);puts("I survived!");}

Try it online!

Runic Enchantments, 23 bytes

>6'RA0)?;"I survived!"@

Try it online!

Nothing too special here. Just an IP that picks a random number [0-6) and prints the required string if the random value isn't 0.

Required string contains two vs which also creates an IP each that get terminated after 100k execution steps (otherwise TIO would produce instant results and the > wouldn't be needed).

Python, 53 bytes

Here's a short 53 byte python index out of range program:

import time
[0][time.time()%6<1]
print("I survived!")

Python 2, 49 bytes

import os
print["I survived!"][os.urandom(1)<'+']

Try it online!

Utilises the idea from this answer of using os.urandom, but we save some bytes by avoiding the ord call.

os.urandom(n) generates n random bytes. By checking if they are smaller than chr(math.ceil(256.0/6)) (== '+'), we get an approximately 1/6 chance of True (== 1).

Java, 98 bytes

interface m{static void main(String[]a){System.out.print(Math.random()<.16?1/0:"I survived!");}}

Try it online

Bonus answer that allocates 2^60 bytes of memory instead of dividing by 0:

import sun.misc.Unsafe;import java.lang.reflect.*;interface M{static void main(String[]a)throws Exception{Field f=Unsafe.class.getDeclaredField("theUnsafe");f.setAccessible(1>0);((Unsafe)f.get(null)).allocateMemory(Math.random()<.16?1L<<60:0);System.out.print("I survived!");}}

TIO

Octave 33 bytes

{"I_Survived!"}(1/(rand(1)>0.16))

Approx each 6 time, there is a warning: division by zero error: index (inf): subscripts must be either integers 1 to (2^31)-1 or logicals

C# (Visual C# Interactive Compiler), 48 bytes

Write(1/new Random().Next(6)<9?"I survived!":"")

Try it online!

Throws Attempted to divide by zero. if a random number in the range [0,6) is 0.

MathGolf, 15 bytes

6rw/;'I ûÄ%$╦'!

Try it online!

Explanation

6r                push [0, 1, 2, 3, 4, 5]
  w               random item from list
   /              divide implicit zero by the random element
    ;             discard TOS (needed for non-crashes)
     'I           push single character "I"
                  space character
        ûÄ%       push "Ä%"
           $      convert to ordinal (from base 256 to base 10)
            ╦     fetch single dictionary word "survived"
             '!   push single character "!"

With some better handling of dictionary fetches, this could probably be 2-3 bytes shorter, but that's not getting implemented within the immediate future.

VB.Net, 38 bytes

If(CInt(Rnd() * 6), "I survived!", Dir())

Throws : System.ArgumentException 'Dir' function must first be called with a 'PathName' argument.

Spaces removed :

If(CInt(Rnd()*6),"I survived!",Dir())

Japt v1.4.5, 16 bytes

6ö
ªí
`I s¨viv!

Try it

-1 byte thanks to @Shaggy!

Throws TypeError: U.í is not a function when a random number in the range [0,6) is 0.

Perl 6, 34 bytes

(^6 .roll&&say "I survived!")||die

Throws an exception to crash.

Try it online!

TI-BASIC (TI-84+/SE), 36 bytes

startTmr→rand:1/(1<randInt(1,6:"I survived!

There is no input, as the challenge specifies.
Output is I survived! if successful, a DIVIDE BY 0 error otherwise.

The DIVIDE BY 0 error screen looks like the following:

ERR:DIVIDE BY 0
1:Quit
2:Goto

Selecting either option (and returning to home screen if 2 is selected) shows Error after the program call.

Examples:

prgmCDGFE
           Error
prgmCDGFE
I survived!
prgmCDGFE
I survived!
prgmCDGFE
           Error

Explanation:

startTmr→rand:1/(1<randInt(1,6:"I survived!   ;full program

startTmr→rand                                 ;store the current time into "rand"
                                              ; this is necessary because "rand" is 0 after
                                              ; factory reset, the default state for TI-BASIC
                                              ; submissions
                   randInt(1,6                ;get a random integer in [1,6]
                 1<                           ;is greater than 1?  1 if true, 0 if false
              1/(                             ;divide 1 by the result
                                              ; throws "DIVIDE BY 0" error if result was
                                              ; false
                               "I survived!   ;leave this string in "Ans"
                                              ;implicitly print "Ans"

Notes:

GNU Bash -- 37 bytes

! followed by nothing doesn't trigger history substitution. $[...] is alternative syntax for arithmetic. (...) is a subshell.

This solution is portable. bash itself does fork but doesn't exec any other programs.

(exit $[$RANDOM%6])&&echo I survived!

JVM Bytecode -noverify, 372 bytes

Works by passing a wrong type to the print function if Random.nextInt(6) is 0.

Hexdump of the class:

$ xxd.exe Code.class
00000000: cafe babe 0003 002d 0020 0c00 1900 1f01  .......-. ......
00000010: 0016 285b 4c6a 6176 612f 6c61 6e67 2f53  ..([Ljava/lang/S
00000020: 7472 696e 673b 2956 0100 106a 6176 612f  tring;)V...java/
00000030: 7574 696c 2f52 616e 646f 6d01 0006 3c69  util/Random...<i
00000040: 6e69 743e 0c00 0400 0803 0000 0006 0700  nit>............
00000050: 1001 0003 2829 5607 0014 0100 0443 6f64  ....()V......Cod
00000060: 6501 0004 6d61 696e 0900 0900 0101 000a  e...main........
00000070: 536f 7572 6365 4669 6c65 0100 076e 6578  SourceFile...nex
00000080: 7449 6e74 0c00 1100 1a01 0013 6a61 7661  tInt........java
00000090: 2f69 6f2f 5072 696e 7453 7472 6561 6d01  /io/PrintStream.
000000a0: 0007 7072 696e 746c 6e0a 0013 001d 0700  ..println.......
000000b0: 0301 0010 6a61 7661 2f6c 616e 672f 5379  ....java/lang/Sy
000000c0: 7374 656d 0a00 1300 050a 0007 000f 0100  stem............
000000d0: 0428 4929 4907 000a 0100 036f 7574 0100  .(I)I......out..
000000e0: 1528 4c6a 6176 612f 6c61 6e67 2f53 7472  .(Ljava/lang/Str
000000f0: 696e 673b 2956 0100 0b49 2073 7572 7669  ing;)V...I survi
00000100: 7665 6421 0800 1b0c 000e 0017 0100 0001  ved!............
00000110: 0015 4c6a 6176 612f 696f 2f50 7269 6e74  ..Ljava/io/Print
00000120: 5374 7265 616d 3b00 2000 1800 1300 0000  Stream;. .......
00000130: 0000 0100 0900 0b00 0200 0100 0a00 0000  ................
00000140: 2900 0500 0100 0000 1db2 000c bb00 1359  )..............Y
00000150: b700 1512 06b6 0012 9a00 0812 06a7 0005  ................
00000160: 121c b600 16b1 0000 0000 0001 000d 0000  ................
00000170: 0002 001e                                ....

Jasmin code to generate:

.source ""
.class Code
.super java/util/Random
.method public static main([Ljava/lang/String;)V
    .limit stack 3
    getstatic java/lang/System/out Ljava/io/PrintStream;
    new java/util/Random
    dup 
    invokenonvirtual java/util/Random/<init>()V
    ldc 6
    invokevirtual java/util/Random/nextInt(I)I
    ifne Survive
    ldc 6
    goto Print
    Survive:
    ldc "I survived!"
    Print:
    invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
    return
.end method

Must to be run with java -noverify to prevent Java from realizing that the class is messed up.

Also it's very wrong this time but CFR output for fun:

/*
 * Decompiled with CFR 0.142.
 */
import java.io.PrintStream;
import java.util.Random;

class Code
extends Random {
    public static void main(String[] arrstring) {
        if (new Random().nextInt(6) != 0) {
            String string = "I survived!";
        }
        System.out.println((String)6);
    }
}
```

Forth (gforth), 51 bytes

include random.fs
: f 1 6 random / ." I Survived!";

Try it online!

Explanation

Randomly gets a number between 0 and 5 (inclusive) Divides 1 by the result Crashes with divide by zero error if random number is 0

Code Explanation

include random.fs       \ include the library file necessary for random to work
: f                     \ start a new word definition
  1                     \ place 1 on the stack
  6 random              \ get a random number between 0 and 5 (inclusive)
  /                     \ divide 1 by the result of the random call
  ." I Survived!"       \ print "I Survived!"
;                       \ end word definition

C++, 105 bytes

#include<iostream>
#include<ctime>
int f(){srand(time(0));delete(int*)!(rand()%6);printf("I survived!");}

In C++, delete behavior is that on 0 ( or nullptr ), nothing occurs

Not as cool ( nor dangerous ) as CommitStrip's russian roulette

05AB1E, 13 12 bytes

6LΩiFë“IЖd!

-1 byte thanks to @Emigna.

05AB1E actually shouldn't be able to error at all, but since the new version of 05AB1E still has some issues compared to the legacy version, I can take that to my advantage to error out for this challenge.

Try it online.

Explanation:

6L          # Create the list [1,2,3,4,5,6]
  Ω         # Get a random choice from this list
   i        # If it is 1:
    F       #  Do a ranged loop, which currently results in a "(RuntimeError) Could not
            #  convert  to integer." error when no argument is given
   ë        # Else:
    “IЖd!  #  Push dictionary string "I survived!" (which is output implicitly as result)

See this 05AB1E tip of mine (section How to use the dictionary?) to understand why “IЖd! is "I survived!".

PowerShell, 40 Chars

IF(6/(Get-Random -Max 6)){'I Survived!'}

On Failure: "Attempted to divide by zero."

Tcl, 64 bytes

puts [expr srand([clock se])*0+int(rand()*6)%6?"I survived":1/0]

Try it online!

J, 18

'I survived!'[q:?6

Failing with domain error when trying to factorise 0.

VBA - 39/46

I don't love Sean Cheshire's numeric output (though still a good answer, it technically fails the No input, and no other outputs are allowed. from the spec...), plus he uses /0, so here are my alternatives:

?Mid("I Survived!",IIf(Int(6*Rnd),1,0))

This resolves to a Run-time error '5': Invalid procedure when trying to reach character 0 (VBA is 1-based indexing).

n="I Survived!":If Int(6*Rnd) Then ?n Else ?-n

This resolves to a Run-time error '13': Type mismatch when applying a negative switch to a string.

Python, 59 55 53, 65 59 56

import os
1/(ord(os.urandom(1))%6)
print"I survived!"

ZeroDivisionError when ord(os.urandom(1))%6 evaluates to 0

import os
print(["I survived!"]*5)[ord(os.urandom(1))%6]

IndexError when ord(os.urandom(1))%6 evaluates to 5

Befunge, 38

v>25*"!devivrus I",,,,,,,,,,,@
?^
v
?^
<1

Pretty straight-forward. Crashing is done by pushing 1s onto the stack until it overflows. I made a few attempts at cutting out those 11 commas and replacing them with some more efficient loop to print everything, but couldn't get it under 11 characters.

Note that counting characters in Befunge is a little tricky... For instance there's only one character on the third line, but I'm counting an extra one there since execution could travel through that location.

Dyalog APL - 25 22 21 20 Charachters

'I Survived!'⊣1÷6⊤?6

Prints DOMAIN ERROR as the error, due to division by zero.

Shortest non-division by zero solution I could come up with is 23 characters.

('I Survived!'1)[~6⍷?6]

It throws an INDEX ERROR

Try it here

APL Font here

Ruby, 24-28

p rand(6)<5?"I survived!":1/0

Approx each 6 time, there is a ZeroDivisionError

There is even a shorter version with 24 characters (Thanks to ugoren and histocrat):

6/rand(6);p"I survived!"

If you don't accept the " in the output, then I need 3 more characters. The first option (puts) adds a newline, the second ($><<) makes no newline:

6/rand(6);puts"I survived!"
6/rand(6);$><<"I survived!"

There is a question about random number in ruby at SO. The seed with srand is automatically called with the seed being from the current time if it wasn't already called. (see Julians comment)


Primo had the idea for an extra bonus to those solutions which don't rely on division by zero.

My first solution can be shortened (28 characters) with a undefined local variable or method ``a' for main:Object (NameError)

p rand(6)<5?"I survived!":a

R 30

"I survived!"[6*runif(1)<5||Z]

One time out of six, it will throw an error: Error: object 'Z' not found

Python (56), Haskell (77)

This crashes with an IndexError when the generated number is 1:

from random import*
print['I survived!'][1/randint(1,7)]

The Haskell solution has the same idea:

import System.Random
main=putStrLn.(["I survived!"]!!).div 1=<<randomRIO(1,6)

Befunge - 48 chars

 v >91+"!devi"v
/?>?<v"I surv"<
 / / :
   :,_@#

Befunge's only randomness is the ? operator, which sends you heading in one of four posible directions (1/4 chance). By blocking one or two directions, you have 1/3 or 1/2 chance, and by combining these, you get 1/6 chance to get out of the program "alive".

The program crashes by doing a divive-by-zero. I guess it's implementation-specific what will happen (on Wikipedia it says the program should ask for the desired answer), but befungee.py sort of crashes, or exits angrily:

$ for i in {1..6} ; do ./befungee.py roulette.befunge ; done
Error (1,2): integer division or modulo by zero
Error (3,2): integer division or modulo by zero
Error (1,2): integer division or modulo by zero
I survived!
Error (0,1): integer division or modulo by zero
I survived!

PHP - 30 bytes

<?rand(0,5)?:~[]?>I survived!

Requires PHP 5.4+ for the short array syntax, invalid operator idea shamelessly stolen from @primo.

As stated, rand() is automatically seeded on first use.

Javascript, 40 chars

In Javascript the divide-by-zero trick doesn't even work: it just returns Infinity. Therefore, referencing a non-existing variable:

alert(6*Math.random()|0?"I survived!":f)

Not so short, though fun :)

Emacs-Lisp, 42 characters

(if (= (random 6) 5) 
    z (message "I survived!")
    )

Python, 70 characters

With inspiration from grc's answer.

from random import*
if randrange(5)<1:exec'()'*9**5
print'I survived!'

randrange(5) returns a value between 0 and 5.
If it returns a 0, Python crashes while attempting to exec(ute) a string of code that contains 9^5 sets of parentheses.

T-SQL 56 44 40 + 6

 if 1/cast(ceiling(rand()*6)-1as int)<2print'I Survived!'

Credit Sean Cheshire for calling out cast as unnecessary

 if 1/ceiling(rand()*6-1)<2print'I Survived!'

Credit personal message from Sean Cheshire for suggestion to change ceiling to floor.

 if 1/floor(rand()*6)<1print'I Survived!'

Death Err Msg: Msg 8134, Level 16, State 1, Line 3 Divide by zero error encountered.

GolfScript, 21 chars

,6rand/;'I survived!'

Like most of the answers, this one has a one in six chance of crashing with a ZeroDivisionError. The shortest solution I could manage without using division by zero is 23 chars:

5,6rand=+;'I survived!'

which has a 1/6 chance of crashing with undefined method `+' for nil:NilClass (NoMethodError).

(Ps. While developing this, I found what might be a bug in the GolfScript interpreter: code like 0,1> appears to leave a nil value on the stack, which will later crash the program if you try to do anything with that value except pop it off and throw it away with ;. Unfortunately, the fact that I do need to use the value somehow to trigger a crash means that even exploiting this bug didn't help me get below 23 chars.)

R, 50 44 42 36

ifelse(!is.na(sample(c(NA,1:5),1)),'I Survived!',)

ifelse(floor(runif(1,0,5))>0,'I Survived!',)

ifelse(floor(runif(1,0,5)),'I Survived!',)

ifelse(sample(0:5,1),'I Survived!',)

Death Err Message:

Error in ifelse(!is.na(1/sample(c(NA, 1:5), 1)), "I Survived!", ) : argument "no" is missing, with no default

Groovy, 39

1/new Random().next(6);print"I survived!"

Picks a random number between 0 and 5 inclusive. If 0, throws a divide by zero exception.

Java, 149

public class R{public static void main(String[]s){int[]a={1,1,1,1,1};System.out.println(a[new java.util.Random().nextInt(7)]>0?"I survived!":"");}}

Fails with an "Array out of bounds" error. Managed to shave a few characters by using anonymous Random object (no imports).

Using the usual divide by zero method:

Perl 5.8 Version

1/(int rand 6)&&print "I survived!"

Perl 5.10 Version

1/(int rand 6)&&say "I survived!"

On failure, these will display:

Illegal division by zero at -e line 1.

Using the bless function which is used for creating objects in perl.

Perl 5.8 Version

print (int rand 6?"I survived!":bless me);

Perl 5.10 Version

say (int rand 6?"I survived!":bless me);

On failure, these will display:

Can't bless non-reference value at -e line 1.

CMD Shell (Win XP or later), 40 +6

I'm only doing this one because DOS is not something that should even be thought of for code golf, and the whitespace is important

set/a1/(%RANDOM% %% 6)&&echo I Survived!

On failure, it will print

Divide by zero error.

Javascript, 42

(Math.random()*6|0)?alert('i survived!'):b

The bitwise or floors the result of the multiplication thus a value between 0 and 5 results. 0 gets implictly casted to false, so in 5 of 6 cases the alert appears in the 6th case a certain b is referenced, crashing the process.

vba, 27

?1/int(6*rnd),"I Survived!"

used in immediate window.
On failure, an error window stating:
division by zero
appears

C, 67 65 62 chars

rand()%8 doesn't lose fairness. Division crashes for t=0, gives true for 1 and 2 (retry), gives false for 3..7 (survived).
EDIT: The previous version used a temporary variable, which ended up completely unneeded. 2/(rand()%8) implements both needed conditions.

main(){
        for(srand(time(0));2/(rand()%8););
        puts("I survived!");
}

PHP 38 bytes

<?~$$s[rand(+$s=sssss,5)]?>I survived!

Placing a + before a non-numeric string will evaluate to 0. Should rand(0,5) return 5, $s[rand(0,5)] will be the empty string (since $s is only five characters long), and subsequently $$s[rand(0,5)] will be an uninitialized variable. Attempting to take the inversion will halt on Unsupported Operand Type. Any other value, 0-4 will return s, and because $s is defined, you will survive.

Note: as of php version 4.2.0, the random number generator is seeded automatically.

Python, 96

from ctypes import*
from random import*
randrange(5)or pointer(c_int())[9**9]
print'I survived!'

If randrange(5) returns 0, then python will crash due to a segmentation fault.