MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

generating non-IID random sequences

  • To: mathgroup at smc.vnet.net
  • Subject: [mg79094] generating non-IID random sequences
  • From: Yaroslav Bulatov <yaroslavvb at gmail.com>
  • Date: Wed, 18 Jul 2007 03:01:01 -0400 (EDT)

I'm looking for a fast way to sample from a Markov-1 sequence of
random bits. The method below is 3600 times slower than built-in
RandomInteger function, can it be made much faster?

p = 0.9; (* the probability of encountering 00 or 11 *)
f = RandomChoice[{p^# (1 - p)^(1 - #), p^(1 - #) (1 - p)^#} -> {1, 0}]
&;
NestList[f, RandomChoice[{0, 1}], 100000]



  • Prev by Date: conditionals on lists
  • Next by Date: two integrals
  • Previous by thread: Re: conditionals on lists
  • Next by thread: Re: generating non-IID random sequences