Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: simple question about random

  • To: mathgroup at
  • Subject: [mg58927] Re: [mg58894] simple question about random
  • From: "David Park" <djmp at>
  • Date: Sun, 24 Jul 2005 01:21:48 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

Define a routine...

nRandom[n_] := Table[Random[Integer, {0, 10}], {n}]

{5, 6, 0, 3, 7, 3}


nRandom[n_] := Array[Random[Integer, {0, 10}] &, n]

{5, 8, 3, 4, 2, 5}

or just use on a one time basis...

Table[Random[Integer, {0, 10}], {6}]
{6, 3, 8, 1, 2, 6}

The humble Table command is very useful and much better than For or Do
(which wouldn't even work in this case.)

David Park
djmp at

From: Mazuego [mailto:mazuego at]
To: mathgroup at

Hi all... The built-in function "Random" gives a random number in a chosen
range. How can I have, for example, 6 random numbers with a single
instruction? Thank you very much for your answers, and forgive me for the
simple question, but I'm new in Mathematica...

  • Prev by Date: Setting gridlines thickness in Plot
  • Next by Date: rotate frametick labels
  • Previous by thread: Re: simple question about random
  • Next by thread: Re: simple question about random