⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rand.c

📁 mips架构的bootloader,99左右的版本 但源代码现在没人更新了
💻 C
字号:
/************************************************************* * File: lib/rand.c * Purpose: Part of C runtime library * Author: Phil Bunce (pjb@carmel.com) * Revision History: *	970304	Start of revision history */unsigned long int rand_next = 1;/**************************************************************  int rand()*	Taken from the K&R C programming language book. Page 46.*	returns a pseudo-random integer of 0..32767. Note that*	this is compatible with the System V function rand(), not*	with the bsd function rand() that returns 0..(2**31)-1.*/int rand(){rand_next = rand_next * 1103515245 + 12345;return((unsigned int) (rand_next/65536) % 32768);}/**************************************************************  srand(seed)* 	companion routine to rand(). Initializes the seed.*/srand(seed)unsigned int seed;{rand_next = seed;}/**************************************************************  randn(limit)*	returns a pseudo-random number in the range 0..limit.*	Assumes that limit is less than 32000.*/randn(limit)int limit;{return((rand()*(limit+1))/32768);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -