[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] rand question



See the SImpleNumber helpfile:

rand

Random number from zero up to the receiver, exclusive.

rand2

Random number from -this to +this.

rand excludes the receiver, rand2 includes it.

Josh


******************************************
Joshua Parmenter
Post-Doctoral Research Associate - Center for Digital Arts and Experimental Media
Raitt Hall - University of Washington
Seattle, Washington 98195



On May 16, 2006, at 2:58 PM, thor wrote:



Hi list

I am puzzled by the difference of rand2 and rand.
I've never stumbled into this before, maybe it's my build
or I am hallucinating but 3.rand never gives me the number 3.

However, 3.rand2 gives me both -3 and 3.

A little test code:

(
a = List.new;
10000.do{
a.add(3.rand)
}
)
a.asString.contains("3")


(
a = List.new;
10000.do{
a.add(3.rand2)
}
)
a.asString.contains("3")


What's up with this?

thor


_______________________________________________
sc-users mailing list