MathGroup Archive 2005

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

Search the Archive

Re: Matrix question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg60303] Re: [mg60287] Matrix question
  • From: "J. McKenzie Alexander" <jalex at lse.ac.uk>
  • Date: Sat, 10 Sep 2005 22:36:22 -0400 (EDT)
  • References: <200509101046.GAA01771@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On 10 Sep 2005, at 11:46, sandog wrote:

> i want to create a NxN matrix with zeros but i want a percentage of  
> the matrix spots to be one at random spots any idea? cause i have  
> no clue how to do that.
> Any help appreciated thx .

Table[If[Random[] < r, 1, 0], {n}, {n}]

Replace r with the desired frequency of ones and n with the dimension  
of the matrix you want.


  • Prev by Date: Re: Matrix question
  • Next by Date: Re: Matrix question
  • Previous by thread: Matrix question
  • Next by thread: Re: Matrix question