1 страниц (4 вхождений)
Using the random function - Сообщения
#1 Опубликовано: 26.06.2010 03:26:24
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
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
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
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
Thanks Radovan, that's just what I wanted.
Brian
Brian
#4 Опубликовано: 27.06.2010 02:57:18
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

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!"
1 страниц (4 вхождений)
-
Новые сообщения
-
Нет новых сообщений