Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*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

Assign a value to a variable

  • To: mathgroup at smc.vnet.net
  • Subject: [mg62996] Assign a value to a variable
  • From: Ben Becker <ben.becker at gmx.de>
  • Date: Sat, 10 Dec 2005 06:03:11 -0500 (EST)
  • Organization: Humboldt University of Berlin, Department of Computer Science
  • Sender: owner-wri-mathgroup at wolfram.com

Hi!

I have a list of variables:
vars = {a, b, c, d, e, f, g, h, i}

and a list of numbers:
numbers = Range[9]

Now i'd like to choose randomly a variable and a number. and then i'd 
like to assign the number to the variable.
I thought of somehting like that:

vars[[Random[Integer, {1, Length[vars]}]]] =
numbers[[Random[Integer, {1, Length[numbers]}]]]

but it doesn't work.

i hope you have an idea!

thank you for answering!

MFG Ben


  • Prev by Date: Re: Skewness problem
  • Next by Date: Re: How to hide a cell?
  • Previous by thread: Re: q: Code for GARCH model in Mathematica
  • Next by thread: Re: Assign a value to a variable