Re: Random often fails to return a result

• To: mathgroup at smc.vnet.net
• Subject: [mg30530] Re: Random often fails to return a result
• From: "Allan Hayes" <hay at haystack.demon.co.uk>
• Date: Tue, 28 Aug 2001 04:54:35 -0400 (EDT)
• References: <9m6taj\$l8a\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Todd,

Random[Integer,n] gives integers between 0 and 1, and, for example

{1,2,3}[[0]]

List

To avoid this use  Random[Integer,{1,n}], which gives integers between 1 and
n.

--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

"Todd Flach" <Todd.Flach at dnv.com> wrote in message
news:9m6taj\$l8a\$1 at smc.vnet.net...
> I have a non-repeatable error that I wonder if someone can explain. I
> am using Random to extract elements of three lists. The Table command
> shows essentially how I do this. The output looks OK except sublist 9
> has an element called List instead of returning a value. This
> extraction error is occurring randomly. I have examined the three
> lists to check if there are any "holes". There are no holes.
>
>
> Table[{starts[[Random[Integer, 100]]], investmentEnds[[Random[Integer,
> 100]]],
>      investmentLevels[[Random[Integer, 100]]]}, {10} ]
>
> {{1.16922, 2.25868, 8.36433}, {2.10013, 5.63926, 8.81981}, {3.85993,
> 3.03134,
>     3.51252}, {0.0660932, 2.43429, 9.08009}, {0.547191, 2.05618,
>     10.5471}, {0.512352, 0.868572, 11.7632}, {0.223057, 5.59492,
>     4.31098}, {2.52853, 2.85432, 8.77673}, {3.85993, 2.25868,
>     List}, {0.179792, 1.03656, 9.36414}}
>

```

• Prev by Date: ArcTan[x, 0] With Numeric Values
• Next by Date: Re: Collecting multiple function arguments into a List?
• Previous by thread: Re: Random often fails to return a result
• Next by thread: Collecting multiple function arguments into a List?