[Question]
  [
Just had a 'spirited' conversation with a co-worker about the succinctness of the following BASIC statement:
```
10 PRINT CHR$(205.5+RND(1)); : GOTO 10
```
It's the title of [this book](https://rads.stackoverflow.com/amzn/click/com/0262018462), and will simply print a sequence of `/` and `\` characters, alternating between the two randomly, resulting in a pattern similar to this:
![enter image description here](https://i.stack.imgur.com/waWtz.png)
*(Image borrowed from <http://www.flickr.com/photos/rndmcnlly/5058442151/sizes/o/in/photostream/>)*
Being of a PHP proclivity, we wondered what the most compact way of writing the same thing in PHP would be, and came up with this:
```
while(1) { echo chr(47 + 45 * rand(0,1)); }
```
`chr(47)` is a `/` character, and chr(92) is a `\`. So the statement `echo chr(47 + 45 * rand(0,1));` will randomly alternate between the two, ad nauseam.
In a language of your choosing, write the shortest program or function to output an infinite random sequence of `\` and `/` characters, where each character has an equal probability of being chosen.
  
[Answer]
Since this has been migrated to codegolf...
### PHP 30 bytes
```
<?for(;;)echo rand(0,1)?~Ð:~£;
```
The `Ð` is character 208, and the `£` is character 163.
Sample usage (on a Windows box):
```
color 18 & php maze.php
```
Produces something similar to:
![](https://i.stack.imgur.com/SEW7W.png)
It works best with a monospace font that is exactly square (here I've chosen the standard system font 8x8). To go back to your default color, you can type `color` again without any parameters.
[Answer]
# Mathematica 157 bytes
Lacking PETSCII, I rolled my own "\" and "/".
No cigar for brevity here. 
```
Graphics[{Thickness[.005],RGBColor[0.73,0.55,1.],Line/@Flatten[Table[RandomChoice[{{{x,y},{x+1,y+1}},{{x+1,y},{x,y+1}}}],{x,40},{y,25}],1]},Background->Blue]
```
![blue maze](https://i.stack.imgur.com/q9lJv.png)
[Answer]
The `goto` operator was added to PHP from version 5.3.0 so you could use the same method as you would in BASIC:
```
a: echo chr(47 + 45 * rand(0,1)); goto a;
```
[Answer]
# Brainfuck - 534
```
>+[->>>>>>[<<<<<<+>>>>>>-]>[<<<<<<+>>>>>>-]<<<<+++++++[<+++++++++++>-]
<[<<[>>>>>>+<<<+<<<-]>>>[<<<+>>>-]<<[>>>>>+<<<+>+<<<-]>>>[<<<+>>>-]<[>
>>>+[<<<+>+>>-]<<[>>+<<-]+<[>-<[-]]>[>+<-]<<-]<-]++++++[>++++++++<-]>-
[<<[>>>>>+<<<<+<-]>[<+>-]>-]<<<[-]>[-]+++++[<+++++>-]<[>>>>>>>+[<<<<<<
+>+>>>>>-]<<<<<[>>>>>+<<<<<-]+<[>-<[-]]>[>>>>+<<<<-]<<-]++++++[>>>>>>+
++++++++<<<<<<-]>>>>>>[<<<<<<<+>+>>>>>>-]<<<<<<[>>>>>>+<<<<<<-]++<[->-
[>+>>]>[+[-<+>]>+>>]<<<<<]>[-]>>[-]<[<<+>+>-]<<[>>+<<-]+>>[-]<[++++[>+
+++<---]>.[-]<<->]<[[>+<+++++]>----.[-]<]>+]
```
My prng (from [here](http://esolangs.org/wiki/Brainfuck_algorithms#x_.3D_pseudo-random_number)) is both large and extremely slow. Perhaps a simpler LFSR or similar would suffice, but this works:
![enter image description here](https://i.stack.imgur.com/XgPdb.png)
[Answer]
# Befunge, ~~12~~ ~~9~~ ~~8~~ 7 Bytes
Edit: [James Holderness](https://codegolf.stackexchange.com/users/62101/james-holderness) figured out an insane solution that uses three quotes instead.
```
?\","/"
```
Overflows the stack with a lot of excess characters for each symbol, but who cares when you can golf that 1 byte?
### Old version
```
"/\"?>,#
```
~~(Note the trailing space)~~ Trailing space apparently not needed (thanks MercyBeaucou)
[Try It Online](https://tio.run/##S0pNK81LT/3/X0k/RsneTkdZ4f9/AA)
```
"/\" Adds both / and \ to the stack
    ? Chooses a random direction to go in. Both up and down loop back around to the ? so it's 50% chance to go in either direction.
Going left
"/\"  >,#  Adds \ and / to the stack but only print the second, the / before heading back
Going right
      >,# Prints the top of the stack, the \ before heading back
```
This does start to fill up the stack, with one extra symbol for every symbol printed.
[Answer]
## C, 39 chars (38 on MSVC)
```
main(){while(putchar(rand()%2?47:92));}
```
![enter image description here](https://i.stack.imgur.com/HOTCgm.png)
[See it run.](http://ideone.com/CqYHL7)
On MSVC, we can replace `putchar()` with `_putch()` and save a byte, but it doesn't work in IDEOne.
```
main(){while(_putch(rand()%2?47:92));}
```
[Answer]
## Common Lisp, 33
```
(loop(princ(elt"/\\"(random 2))))
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 5 bytes
```
Ø^XȮß
```
[Try it online!](https://tio.run/##y0rNyan8///wjLiIE@sOz///HwA "Jelly – Try It Online")
`XØ^ß` is a byte shorter, but prints a `0` before the slashes.
```
  X      Choose a random element from
Ø^       "/\",
   Ȯ     print it,
    ß    then call this link again.
```
[Answer]
`print` has a return value of 1, so if you use that you can just wrap the whole expression in the `while`:
`while(print chr(47 + 45 * rand(0,1));`
You can probably golf it further too.
[Answer]
# [Vyxal](https://github.com/Lyxal/Vyxal), 5 bytes
```
{k/℅₴
```
No trying it online
It was a smart choice adding all of the two byte constants of 05ab1e and Jelly.
[Answer]
# [C (gcc)](https://gcc.gnu.org/), 47 bytes
```
main(){while(putchar(47+45*(rand()/(1<<30))));}
```
[Try it online!](https://tio.run/##S9ZNT07@/z83MTNPQ7O6PCMzJ1WjoLQkOSOxSMPEXNvEVEujKDEvRUNTX8PQxsbYQBMIrGv//wcA "C (gcc) – Try It Online")
[Answer]
## Python 3, ~~59~~ 51 bytes
Using only 1 line (in the spirit of the original 10 PRINT):
~~`from random import*;exec("while 1:print(end=choice('\/'))")`~~
```
while 1:from random import*;print(end=choice('\/'))
```
Or (possibly not that random) using hash for just 47 bytes (but on 2 lines):
```
x=0
while 1:x=hash(str(x));print(end='\/'[x%2])
```
[Try it online!](https://tio.run/##K6gsycjPM/7/v8LWgKs8IzMnVcHQqsI2I7E4Q6O4pEijQlPTuqAoM69EIzUvxVY9Rl89ukLVKFbz/38A "Python 3 – Try It Online")
[Answer]
## ruby, 27 23 chars
```
loop{$><<"/\\"[rand 2]}
```
`$><<` is 'print to stdout'. 
[Answer]
# C++, 45 Chars
```
int main(){for(;;)cout<<(rand()%2?"/":"\\");}
```
Not going to win any awards for shortness, but I had already written this when I heard about the mentioned book, so I just golfed it.
The putchar trick also works in C++, getting you down to 43, but you can't avoid declaring the return type on main.
[Answer]
i try create using css style, and it's work 
```
<style>
  body {
    font-family: monospace;
    line-height:75%;
    letter-spacing:-3px;
  }
</style>
```
this php code : 
```
<?php
  $i=10000;
  while($i) {
    if($i%200 == 0) echo '<br/>';
    echo chr(47 + 45 * rand(0,1));
    $i--;
  }
?>
```
[Answer]
# Common Lisp - 68
```
(defun s(l)(elt l(random(length l))))(loop do(format t"~a"(s"/\\")))
```
[Answer]
## Python, 68
In the "my language sucks at this" category, we've got Python!
```
import random,sys
while 1:sys.stdout.write(random.choice('/\\'))
```
Thanks to Ivo for a few chars on imports and `choice`.
[Answer]
## 16-bit x86 assembly code, 10 bytes
I don't remember if this one ended up in the book.
```
init:
scasb            ;read from where ES:DI points and compare to AL 
                 ;this sets flags similar to a subtraction 
salc             ;set mask in AL to 00 or FF 
and   al,'\'-'/' ;begin choosing character (AL is 00 or 2D) 
add   al,'/'     ;finish choosing character 
writec:
int   29h        ;write char in AL 
jmp   init       ;loop endlessly
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 7 bytes
```
["/\"Ω?
```
[Try it online!](https://tio.run/##MzBNTDJM/f8/Wkk/RuncSvv//wE "05AB1E – Try It Online")
```
["/\"Ω?  - Full program
[          Start an infinite loop
 "/\"      ... Push the string "/\" on the stack
     Ω     ... Pick a character from the top of the stack, at random
      ?    ... Print without a newline
```
[Answer]
# [Befunge-98 (PyFunge)](https://pythonhosted.org/PyFunge/), 7 bytes
```
? '/,\'
```
[Try it online!](https://tio.run/##S0pNK81LT9W1tNAtqAQz//@3V1DX14lR//8fAA "Befunge-98 (PyFunge) – Try It Online")
the `?` sends the IP either left or right, so either `/` or `\` is pushed before printing with `,`. When executing the `'/` or `\'` in the wrong order after printing, it just does things to the stack (divides or swaps), and then pushes an irrelevant character before repeating.
[Answer]
# PHP, ~~26~~ 31 bytes
~~eight~~ three bytes shorter than yours (without whitespace or braces)~~,  
two bytes shorter than [primo´s solution](https://codegolf.stackexchange.com/a/9170/55735) (without the tag)~~.
PHP 5.4.9 was the current version in December 1012, so ...
```
for($s="\/";;)echo$s[rand()%2];
```
~~requires PHP 5.5 or later for literal string indexing.~~
Run with `-r` or [try it online](http://sandbox.onlinephpfunctions.com/code/f622d0f9cdb06e92357a2c243fe5aca069d1875f).
[Answer]
## [Keg](https://esolangs.org/wiki/Keg#Command_Glossary), 12 bytes
You do not have to worry about the evenness 0f the output, because the range is 0 to 32767, and 32767+1 = 32768; it is an even number.
```
{~2%[\\|\/],
```
[Answer]
# HTML+JS, 186
```
<pre style="letter-spacing:-3.5px;line-height:9px;;white-space: pre-wrap;line-break: anywhere;" onclick="setInterval(_=>this.innerHTML+='/\\'[2*Math.random()|0])">C l i c k   m e !</pre>
```
[Answer]
Not much better. Needs php 5.5+ for the array dereferencing feature.
```
while(1) { echo ['/', '\\'][rand(0, 1)]; }
```
[Answer]
# [><>](https://esolangs.org/wiki/Fish), 14 bytes
I was hoping I could restrict it to a 3\*3 square but didn't succeed.
```
"/\
~x/
o</
 !
```
You can try it [here](https://fishlanguage.com/playground).
[Answer]
# [Cubix](https://github.com/ETHproductions/cubix), 12 bytes
```
D<^<!"/\"B!o
```
**[View in the online interpreter!](https://ethproductions.github.io/cubix/?code=RDxePCEiL1wiQiFv&input=&speed=50)**
This maps out to the following cube net:
```
    D <
    ^ <
! " / \ " B ! o
. . . . . . . .
    . .
    . .
```
## Explanation
**Setup:**
The IP begins heading east at the first `!`. This is the 'skip if truthy' command, which is False when there is nothing on stack, so no commands are skipped. `"/\"` enters stringmode and appends these two character codes to the stack. `B!o` is mostly a no-op here, only reversing the stack.
The IP now loops back around to the first `!`. However, there are now positive integers on stack, so the first `"` is skipped. This means `/` is no longer a character, but a mirror, sending the IP north into the main loop.
**Main Loop:**
The `D` command is the only source of randomness in Cubix. It sends the IP in a random direction. By blocking off South and East with arrows, we make sure the IP has a 50% chance of heading North, and a 50% chance of heading West.
If it heads West, the stack is reversed. If it heads North, the top character is printed.
This creates the random sequence of slashes, as desired.
[Answer]
# SmileBASIC, 20 bytes
```
?"/\"[RND(2)];
EXEC.
```
[Answer]
# [PowerShell](https://docs.microsoft.com/en-us/powershell/scripting/overview), ~~108~~ ~~90~~ ~~86~~ ~~54~~ ~~53~~ ~~37~~ 36 bytes
```
for(){Write-Host "\/"[(Random 2)]-n}
```
[Try it online!](https://tio.run/##K8gvTy0qzkjNyfn/Py2/SEOzOrwosyRV1yO/uERBKUZfKVojKDEvJT9XwUgzVjev9v9/AA "PowerShell – Try It Online")
[Answer]
# Java 8, ~~60~~ ~~59~~ ~~54~~ 53 bytes
```
v->{for(;;)System.out.write(Math.random()<.5?47:92);}
```
-1 byte thanks to *@BenjaminUrquhart* by replacing `print` with `write`, so `'/'` can be `47`.
**Explanation:**
[Try it online](https://tio.run/##ZY49D4IwFEV3f8Ub24EORmO0fkyOspi4GIdnKVKFlrQP1BB@O4K4ubybl9yce@5YY3RPHp3KMQQ4oLHNBMBY0j5FpSEeXoDamQQUOw1Rc6DMu2eA/Uvpkoyzsi@1k/4EQjIKYrCwga6Otk3qPJOSH9@BdCFcReLpDWl2QMqER5u4gvG1mO9mi9VyymXbyQFUVte8B/143/mil2NH8sbezhf8lxhNrVDMVnnOR6e2@wA) (times out after 60 sec).
```
v->{                     // Method with empty unused parameter and no return-type
  for(;;)                //  Loop indefinitely
    System.out.write(    //   Print:
      Math.random()<.5?  //    If the random decimal value in range [0,1) is below 0.5:
       47                //     Print forward slash
      :                  //    Else:
       92);}             //     Print backward slash
```
[Answer]
# [Cubix](https://github.com/ETHproductions/cubix), 10 bytes
```
Du\'^>o$/;
```
[Watch it run](https://ethproductions.github.io/cubix/?code=RHVcJ14+byQvOw==&input=&speed=20)
```
    D u
    \ '
^ > o $ / ; . .
. . . . . . . .
    . .
    . .
```
Was an interesting one to do as i haven't played with the random direction generator much.
* `^D` redirect to the random direction pointer
Directed north
* `o\>` loops around the cube, print empty stack and redirecting back into the print commands (stack is empty)
Directed west
* `^` redirected back into the random direction pointer
Directed south
* `\'/>` reflected to the east, push / onto the stack and redirect into the print commands
Directed east
* `u'\>` uturn to the right, push \ onto the stack and redirect into the print commands
Print commands
* `o$/;^` output top of stack, skip over the reflect, pop from the stack and redirect into the random direction pointer
]