Re: sparsearray and random

*To*: mathgroup at smc.vnet.net*Subject*: [mg71456] Re: sparsearray and random*From*: Bill Rowe <readnewsciv at sbcglobal.net>*Date*: Sun, 19 Nov 2006 01:10:11 -0500 (EST)

On 11/18/06 at 4:41 AM, Arkadiusz.Majka at gmail.com wrote: >a = Random[Integer, {3, 7}] >Normal[SparseArray[(i_ /; 3 â?¤ i â?¤ a) -> p, 10]] >is not the same as this: >Normal[SparseArray[(i_ /; 3 â?¤ i â?¤Random[Integer, {3, 7}] ) -> p, >10]] In the first case you generate a single random number. In the second case you generate a random number for each position for each element of the array. Compare a = Random[Integer, {3, 7}] SparseArray[i_ /; 3 <= i <= a -> p, 10]//Trace to SparseArray[i_ /; 3 <= i <= Random[Integer, {3, 7}] -> p, 10]//Trace -- To reply via email subtract one hundred and four