Hey, I've been looking into changing RR.random_element and RDF.random_element to do something more sensible than create a random integer in the range -2 to 2 and coerce it into the reals. The reasonable thing to do for RDF seems to be to use GSL, create a RealDistribution and then return a random element from that. Two issues arise: 1) This doesn't work for RR, since GSL's distributions (as far as I can tell) only support doubles. Does anyone know how to get various distributions in mpfr? Also, where can I find documentation on the interface to mpfr? Their website suggests there are multiple ones.... 2) If you create a lot of RealDistributions quickly, their initial values seem to agree fairly often. For example, sage: L = [RealDistribution('gaussian', RDF(1)).get_random_element() for _ in range(50)] sage: Ldict = {} sage: for m in L: ...: if Ldict.has_key(m): ...: Ldict[m] = Ldict[m] + 1 ...: else: ...: Ldict[m] = 1 ...: sage: Ldict
{-1.97183627646 : 1, -1.38176904179: 4, -1.1574992194: 2, -0.885770378312: 2, -0.771164851336: 2, -0.757752144086: 1, -0.746099959575: 4, -0.693091109446: 1, -0.685217028642: 5, -0.38901172123: 1, - 0.315558170546: 2, -0.264326023715: 2, -0.183537311896: 2, -0.153138950133: 3, 0.0996438605326: 1, 0.30639951233: 1, 0.338001249663: 1, 0.393989493557: 3, 0.51919088944: 2, 0.6674486868 : 2, 0.818610064197: 1, 0.822495637678: 1, 0.996828351594: 2, 2.06664604023: 4} Naively, this seems like the wrong behavior: they should all be distinct. Now, maybe I just need to set the seed manually. It seems like we could set the seed by default with some other source of randomness though... David --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~----------~----~----~----~------~----~------~--~---