MathGroup Archive 2007

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

Search the Archive

Re: Create random binary images

  • To: mathgroup at
  • Subject: [mg83724] Re: [mg83637] Create random binary images
  • From: Carl Woll <carlw at>
  • Date: Thu, 29 Nov 2007 06:21:25 -0500 (EST)
  • References: <>

Tara.Ann.Lorenz at wrote:

>I am trying to create several random binary images of 30x30.  I want
>the outputs to be 1's and 0's, with 5% of the outputs being 1's.  Any
>ideas on how to code this in Mathematica?
Use RandomChoice. For example:

RandomChoice[{5, 95} -> {1, 0}, {30, 30}]

Carl Woll
Wolfram Research

  • Prev by Date: Re: Convert nxn matrix to a column vector with (n^2) elements
  • Next by Date: Re: Mathematica 6 and system of matrix and scalar ODEs in NDSolve:
  • Previous by thread: Create random binary images
  • Next by thread: Re: Create random binary images