MathGroup Archive 2001

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

Search the Archive

Re: Random often fails to return a result

  • To: mathgroup at smc.vnet.net
  • Subject: [mg30528] Re: [mg30513] Random often fails to return a result
  • From: BobHanlon at aol.com
  • Date: Sat, 25 Aug 2001 01:15:10 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

In a message dated 2001/8/24 9:58:11 PM, Todd.Flach at dnv.com writes:

>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.
>
>Thanks in advance for any advice!
>
>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}}
>

Random[Integer, max] is equivalent to Random[Integer, {0, max}], that is, you 
can get the value zero.

Table[Random[Integer, 3], {10}]

{3, 0, 0, 0, 1, 3, 2, 3, 2, 0}

Part 0 is the head.

{a, b, c}[[0]]

List

Use Random[Integer, {1, 100}]


Bob Hanlon
Chantilly, VA  USA


  • Prev by Date: Re: extra vertical lines showing up in plots
  • Next by Date: RE: extra vertical lines showing up in plots
  • Previous by thread: Random often fails to return a result
  • Next by thread: Re: Random often fails to return a result