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

📄 test.java

📁 页面置换算法 包括fifo 先进现出
💻 JAVA
字号:
package 操作系统;

import java.util.Arrays;

public class test {// 最近最少使用置换算法(LRU)
	public static final int PROGRAMNUM = 24;
	public static final int SIGMA = 5;
	public static final int MIU = 6;

	public static void main(String[] args) {
		int[] a = new int[25];
		for (int i = 0; i < 25; i++)
			a[i] = Norm_rand();
		Arrays.sort(a);
		for (int m : a)
			System.out.print(" " + m);
	}

	public static int Norm_rand() {
		double N = 12;
		double x = 0, temp = N;
		do {
			x = 0;
			for (int i = 0; i < N; i++)
				x = x + (Math.random());
			x = (x - temp / 2) / (Math.sqrt(temp / 12));
			x = MIU + x * Math.sqrt(SIGMA);
		} while (x <= 0); // 在此我把小于0的数排除掉了
		int m = (int) x;
		if (m <= 0)
			m = 1;
		else if (m > PROGRAMNUM)
			m = PROGRAMNUM;
		return m;

	}
}

⌨️ 快捷键说明

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