Python3 调用c中srand 随机数

import sys
from ctypes import *

if sys.platform == 'win32':
	print(cdll.msvcrt.srand(1))
	print(cdll.msvcrt.rand())

if sys.platform == 'linux':
	libc = cdll.LoadLibrary("/lib/x86_64-linux-gnu/libc.so.6")
	libc.srand(1)
	print(libc.rand())
posted @ 2021-08-08 19:47  wgf4242  阅读(290)  评论(0编辑  收藏  举报