[erlang-questions] How random is this

Johan Montelius johanmon@REDACTED
Tue Oct 9 08:49:51 CEST 2007



I needed a procedure that made a process crash with random intervals so I  
wrote someting like this:

-module(crash).
-export([crash/0]).

crash() ->
   case random:uniform(100) of
	X when X < 10 ->
	  true = false;
	X ->
	  %% io:format("value ~w~n", [X]),
	  ok
   end.


works fine until it actually crashes, then the random function does not  
generate a new value, it's stuck in the value that caused the crash. Could  
be a feature, could be somthing else.

   Johan


-- 
Johan Montelius
KTH  ICT/ECS
There are 10 types of people in the world - those who understand binary  
and those who don't.



More information about the erlang-questions mailing list