[Squeakland] Random
Gustavo Correa H.
gustavo.correa at coheco.com
Tue Apr 12 08:11:10 PDT 2005
Alan:
I can understand that not all possible features should be included in eToys
but, could you help me in obtaining a Random number when you do not know
before hand the limits of the numbers range but it depends on the results of
some script calculations?
Regards
PolloGus (Quito-Ecuador)
-----Mensaje original-----
De: Alan Kay [mailto:alan.kay at squeakland.org]
Enviado el: Lunes, 11 de Abril de 2005 22:04
Para: gustavo.correa at coheco.com; squeakland at squeakland.org
CC: Javier Diaz-Reinoso
Asunto: Re: [Squeakland] Random
This is why there is no parameter on the random tile. It is good for
children to realize that they can get a random number in any interval by
simple addition.
The random number tile generates numbers between 1 and the number that is
set on it. So if we want to generate random numbers between 15 and 21, then
we can do this by the sum: 14 + random 7. Often it is a good idea to make a
new variable to hold such calculations:
newRandom <- 14 + random 7
would be a typical line in a script.
In general it is good to help children to do "automatic arithmetic"
whenever they see numbers. There are other places in the etoys where one
might also put "a feature", but where having the children do a simple
relationship from scratch is better for them.
Cheers,
Alan
At 11:20 AM 4/11/2005, Gustavo Correa H. wrote:
>Dear Friends at Squeakland:
>
>I need to get a random number between two numbers to be determined as the
>result of some actions. Could you tell me how to get such result with the
>random tile function which does not accept a variable as its argument?
>
>I appreciate your help.
>
>PolloGus (Quito-Ecuador)
>
>
>
>_______________________________________________
>Squeakland mailing list
>Squeakland at squeakland.org
>http://squeakland.org/mailman/listinfo/squeakland
More information about the Squeakland
mailing list