Using the random function

Using the random function - Сообщения

#1 Опубликовано: 26.06.2010 03:26:24
Brian Runagle

Brian Runagle

13 сообщений из 27 понравились пользователям.

Группа: User

Hi

I have a problem using the random function.

If I assign a random number to a variable, x=random(6) for example, and look at the value once I see a value, say x=4. If I look at it again I get a different number, say x=2, and so on. It's as if looking at the variable x calls the random function again.

This also occurs in SMath Live.

The question is then, how can I "freeze" the value of x so that I can work with a random value without it changing every time I look at it?

Many thanks

Brian
#2 Опубликовано: 26.06.2010 14:35:56
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2052 понравились пользователям.

Группа: Moderator

Hello Brian,

Just select the region x=random(6) and right clik on it. Choose Optimization=>Numeric. After that you can work with the random number, and x random value is "freezed" then. If you want to use another random number just Recalculate page (F9)

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#3 Опубликовано: 27.06.2010 02:09:48
Brian Runagle

Brian Runagle

13 сообщений из 27 понравились пользователям.

Группа: User

Thanks Radovan, that's just what I wanted.

Brian
#4 Опубликовано: 27.06.2010 02:57:18
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2052 понравились пользователям.

Группа: Moderator

You are welcome

I suggest you to use SMath Wiki and, of course, to use this Forum in order to express your opinion how to improve SMath or to report bugs as well.

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений