MathGroup Archive 2005

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

Search the Archive

Re: Matrix question

If n is size of matrix and 100p is the percentage, try

n = 10; p = 0.1; Table[UnitStep[Random[] - (1 - p)], {n}, {n}]

Best regards

Ingolf Dahl

> -----Original Message-----
> From: sandog [mailto:sandog at] 
To: mathgroup at
> Sent: den 10 september 2005 12:47
> Subject: [mg60299] [mg60287] Matrix question
> 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 .

  • Prev by Date: Re: Re: Condition for pure functions
  • Next by Date: Re: Matrix question
  • Previous by thread: Re: Matrix question
  • Next by thread: Re: Matrix question