Skip to main content
1 of 3

Haskell, 167 172 chars

import System.Random
main=(fmap g$randomRIO(1::Int,6))>>=putStrLn
g x=h++c odd++reverse h where{h=concat["-----\n|",c(>1)," ",c(>3),"|\n|",c(>5)];c f|f x="o"|True=" "}

It uses roughly the same idea as the Python one.

Readable version:

import System.Random

main = do
    x <- fmap render $ randomRIO (1 :: Int, 6)
    putStrLn x

render x = str ++ check odd ++ reverse str
  where
    str = concat
        [ "-----\n|"
        , check (> 1)
        , " "
        , check (> 3)
        , "|\n|"
        , check (> 5)
        ]
    check f = if f x then "o" else " "