我正在使用java.util.Random生成随机高斯.我需要将此高斯转换为浮点值.然而高斯是一个双,所以我需要一些方法来圆或然后将其转换为浮点数.我需要四舍五入到最近的整数,四舍五入.这是我的问题:如何?
我一直在尝试在我的 Linux 操作系统上学习 32 位 Intel x86 nasm 语法程序集,我遇到了一个关于四个通用 32 位寄存器的问题。
从我一直思考,EAX是,本来要使用的32位寄存器与16位寄存器AX,其中又分为啊(高8位)和人(低8位)。ebx、ecx 和 edx 也是如此。
然而,在阅读了一篇快速文章后,我变得有点困惑。
32 位寄存器是否由 16 位寄存器(依次由两个 8 位寄存器组成)加上额外的 16 位组成?
到目前为止,我在谷歌上读到的所有结果都说明了它们的用途,而不是它们的实际组成。
可能重复:
括号在x86 asm中的含义是什么?
我有一段时间对此感到困惑."si"和"[si]"有什么区别?(这是使用16位NASM语法)
我试图将数组中的值设置为变量.这是我的代码:
//init the array as a float
//I have tried to put a value in the brackets, but it returns a different error.
//I initialized it this way so I could call it from other methods
private float[] map;
// generate a "seed" for the array between 0 and 255
float x = generator.nextInt(256);
int n = 1;
// insert into the first 25 slots
while(n <= 25) {
// here's my problem with this next line
map[n] = x; …Run Code Online (Sandbox Code Playgroud)