Categories
Game Development PC Nerding

Raspberry PI and Random values

I’m developing a simple rpg game, testing it with .NET on Win and Mono on Win/Mac/Linux works perfectly. Today I decided to test it on my Arch Raspberry PI to see if it could run well on this device and the result is that the game won’t even start for some “Array out of index” exception that does not appear with other systems.
After some time debugging here and there, I found out that the Random.Next function does not behave correctly on RPi.
Running this test code:
Random r = new Random();
for (int i = 0; i<10; i++) { Console.WriteLine(r.Next(0,7)); }

on the RPi prints ten times the number seven!
This is wrong for two reasons: First obliviously it's not returning random numbers and secondly it is returning the maxValue, which should be "exclusive" and it may never be returned by the function.
So calling something like
array[random.Next(0,array.Length)]
should return a value between 0 and array.Length-1, but it returns array.Length causing my out of index exception.

I tried testing Random.Next(), Random.Next(int) and Random.NextDouble() and they all behave correctly. I dunno if this is a bug in Mono:ARM or something related to the Raspberry PI.

UPDATE: Further investigations lead me to think that the problem was actually Math.Round(double), which is called in Random.Next. I'm not sure I understood it completely but looks like it is a well know problem: Mono:ARM does not support PI's hard float OSs, causing errors while working with floating point numbers. There's a patch for that and even an official RPi Debian distro with soft float support, which I won't bother installing right now. Next time PI, next time.

UPDATE: 3 April
Found an hard float version of Mono here on official Pi forums. I tested it on a clean upgraded dist-upgraded Raspbian "wheezy" from 2013 Feb 09 image and it works, remember to expand the root filesystem through raspi-config or to uninstall unneeded packages as wheezy's root partition is 2gb only and is filled with junk stuff (at least junk for me, as I use my RPI via command line SSH). On my Arch setup for some reason it was not working, but an user reported in that thread that it works on his Arch, so I think was my fault, probably some file from my previous mono test that wasn't deleted or overwritten.

Categories
PC Nerding Personal Life

What are top specs laptops missing?

Note: with “top specs” I include everything Mobile Workstation, All-Around, Desktop Replacement and some Gaming laptops.

I used to love (and still I do) high end laptops and how they offer lots of raw power, effectively removing the need of a desktop computer even for work. Newer ones offer SSD + Hard disk combo for both fast loading and a good amount of local storage, four ram slots for upgrading, 120Hz 3D displays supporting Nvidia active shutter technology (the only one that doesn’t make me want to rip off my eyes), 7.1 audio, BlueRay drives and tens of ports exactly like their desktop counterpart, while costing two times more.

But they still miss two things that are making those laptops not really filling the gap:
A retina-like display.
I like apples a lot, but I usually don’t like tech products that shows in searches when I google for apples. I have nothing against that particular company, and even if you reader fall in the “I have to absolutely hate a company, whatever it does” category, there are some innovations you simply can’t pass over.
One of those is the higher resolution displays.
Making it short: I don’t care about a 10 inch 2048×1536 display, what I’m really saying is that HD was cool in 2006, 2007. Now its dead. It is time to sell laptops with higher resolution, because in a 15 or 17 inch computer displays, having more resolution means having more work space and having more work space means, usually, more productivity for developers of any kind.

The old fashioned 4:3 displays
While most people I know will say “I hate black bands while I watch films”, I learned to love with them. As my current configuration is a 17 inch 16:19 laptop plus a 17 inch 4:3 monitor, I still have those on both displays, and I absolutely don’t care about them. The problem is that my 4:3 is on a side and I’m currently using my laptop keyboard, this means that using a code editor on the 19′ requires my neck to be rotated by around 45 degrees, making it uncomfortable for longer time spans and completely useless for working outside office/home. I’d really like to have my main screen (laptop one) in 4:3, it will have more work space for a coder, as it will show more code lines than 16:9 and 16:10 displays. I know it will be bulkier, but as I love black bands I will learn to love having a bigger notebook. “The bigger the better!”

This is obliviously only a personal preference but in my opinion top specs laptops are for working people, not for the casual user.

Categories
PC Nerding

Why I will give my money to Michael, again.

51Calling by it’s first name a CEO is usually “not educate” but his company’s product is one of my best friends, making him a friend too.
Long story short, a couple days ago I found out that my old Dell XPS M1730 lappy was able to reproduce 5.1 audio without an external sound card or adapter. It fucks my mind to see an output cable plugged into a microphone hole, which is supposed to be an input, but it works and it works pretty well. I have this pc since 2008, at the time the possibility of having a 2,8ghz dual core and two Nvidia 8800M GTX in a laptop surprised me a lot, and sometimes this laptop still surprises me.

And this why, when time will come, I will only replace this laptop with another from this series.