PI->NNI ? Awkward indeed. In other langs: C++ int rand (void); Returns a pseudo-random integral number in the range between 0 and RAND_MAX <http://www.cplusplus.com/RAND_MAX>.
Python import randomprint(random.randint(-9,9)) PHP int *rand* ( int $min , int $max ) CL (where Fricas' random is based on) http://clhs.lisp.se/Body/f_random.htm This might explain why 'random' it's implemented as is. What about the quality of RANDOM()$Lisp? (1) -> )d op random There are 6 exposed functions called random : [1] -> D from D if D has FINITE [2] D -> D from D if D has INS [3] Integer -> Integer from Integer [4] NonNegativeInteger -> NonNegativeInteger from NonNegativeInteger [5] PermutationGroup(D2) -> Permutation(D2) from PermutationGroup(D2 ) if D2 has SETCAT [6] (PermutationGroup(D3),Integer) -> Permutation(D3) from PermutationGroup(D3) if D3 has SETCAT There are 3 unexposed functions called random : [1] PositiveInteger -> SparseUnivariatePolynomial(D3) from FiniteFieldPolynomialPackage(D3) if D3 has FFIELDC [2] (PositiveInteger,PositiveInteger) -> SparseUnivariatePolynomial( D3) from FiniteFieldPolynomialPackage(D3) if D3 has FFIELDC [3] PositiveInteger -> Vector(D3) from InnerNormalBasisFieldFunctions(D3) if D3 has FFIELDC Yet (2) -> random(-4::Integer)$Integer >> System error: Argument is neither a positive integer nor a positive float: -4 On Monday, 17 October 2016 04:02:31 UTC+2, oldk1331 wrote: > > > Current definition means that for positive n you get exactly n > > values, each with probablility 1/n. Your proposed change would > > break this nice relationship. For people who can not read > > between lines we could add phrase: 'Error if n <= 0.'. > > Then the signature for random will be awkward: PI -> NNI > > For my definition, it's valid for all integers (if n<0, return random > integer from -n to 0), although the probablility will be 1/(n+1). > -- You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/fricas-devel. For more options, visit https://groups.google.com/d/optout.
