Marco, Our Random module uses the NPB linear congruential generator algorithm. My understanding is that 0 and 1 are not included.
Array reallocation is done by assigning to the array's domain - just like what your code snippet does. In some situations you can also assign to the array's domain directly: var A: [0..0] uint; // 1 element A.domain = 0..N; // add N elements to A Vassily On 01/29/15 15:04, Marco Postigo wrote: > Hello, > I have some questions about the randomFill(x:[]) function and array > reallocation. > First of all I need to use the Random Module and I'm not sure what the > interval > is of the numbers returned... I've found in a paper where it was stated that > it > returns values between 0 and 1... inclusive? exclusive? > Is it as in most other languages [0, 1) or are both incluse ( -> [0, 1] )? > Second is the reallocation of arrays... I haven't found any examples so I've > tested a bit around and only got it worked with using a domain and reassigning > it. Is this the correct way or is there another "nicer" solution? > code snippet: > 9 /** Domain of lifeline buddies array */ > 10 var lifelinesDomain : domain(rank=1) = 0..0; > 11 /** Lifeline buddies */ > 12 var lifelines : [lifelinesDomain] uint; > ... > 55 lifelinesDomain = 0..(p.z-1); // reallocation in constructor > Sorry if this questions are duplicates or if I've just overlooked the solution > in your spec / docs. > Kind regards, > Marco ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Chapel-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/chapel-users
