help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Rand implementation question


From: Dmitri A. Sergatskov
Subject: Re: Rand implementation question
Date: Thu, 27 Feb 2014 20:54:18 -0600

On Thu, Feb 27, 2014 at 8:45 PM, mpender <address@hidden> wrote:
I have had intermittent strange behavior when attempting to use the rand
function to create binary digits that I would like advice about.

I usually use an _expression_ like the following to produce a random binary
digit of either '0' or '1'
digits = round (rand(size(1:8)) + 0.5)



If I need a random bit (or sequence of say 10000) I usually do:

a=(rand(1,10000)>0.5);

Dmitri.
--


reply via email to

[Prev in Thread] Current Thread [Next in Thread]