[erlang-questions] HOWTO GENERATE RANDOM NUMBER?

Michael McDaniel erlangx@REDACTED
Thu Dec 6 07:34:10 CET 2007


On Wed, Dec 05, 2007 at 10:04:34PM -0800, Dino M. B. wrote:
> 
> Hi Everyone,
> 
> I am complete erlang beginer, please elaborate.
> 
> How do I create a function in erlang  that will generate a rundom integer number btw say 1 and 10 and return it ?
> 
> Thanks
> 
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
mmcdanie@REDACTED:~/misc/src/erlang$ erl
Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.5.5  (abort with ^G)
1> random:uniform(10).
1
2> random:uniform(10).
5
3> random:uniform(10).
8
4> q().
ok
5> mmcdanie@REDACTED:~/misc/src/erlang$ erl -man random

 ...


~Michael



More information about the erlang-questions mailing list