示例#1
0
    def rand_seed(self):
        """
        Return a random seed that can be put into ``set_seed`` function
        for any interpreter.

        This should be overridden if the particular interface needs
        something other than a small positive integer.

        EXAMPLES::

            sage: from sage.interfaces.interface import Interface
            sage: i = Interface("")
            sage: i.rand_seed() # random
            318491487L

            sage: s = Singular()
            sage: s.rand_seed() # random
            365260051L
        """
        import sage.doctest
        if sage.doctest.DOCTEST_MODE:
            # set the random seed through the current randstate
            from sage.misc.randstate import current_randstate
            seed = current_randstate().seed()
        else:
            from sage.misc.randstate import randstate
            seed = randstate().seed()

        return seed & 0x1FFFFFFF
示例#2
0
    def rand_seed(self):
        """
        Return a random seed that can be put into ``set_seed`` function
        for any interpreter.

        This should be overridden if the particular interface needs
        something other than a small positive integer.

        EXAMPLES::

            sage: from sage.interfaces.interface import Interface
            sage: i = Interface("")
            sage: i.rand_seed() # random
            318491487L

            sage: s = Singular()
            sage: s.rand_seed() # random
            365260051L
        """
        from sage.misc.randstate import randstate
        return randstate().seed() & 0x1FFFFFFF
示例#3
0
    def rand_seed(self):
        """
        Return a random seed that can be put into ``set_seed`` function
        for any interpreter.

        This should be overridden if the particular interface needs
        something other than a small positive integer.

        EXAMPLES::

            sage: from sage.interfaces.interface import Interface
            sage: i = Interface("")
            sage: i.rand_seed() # random
            318491487L

            sage: s = Singular()
            sage: s.rand_seed() # random
            365260051L
        """
        from sage.misc.randstate import randstate
        return randstate().seed()&0x1FFFFFFF