Entries from 2012-03-01 to 1 month

言語別の乱数生成方法

0からnまでの整数の乱数を生成する方法を、言語別にメモしておく。 C #include <stdlib.h> srand(time(NULL)); rand() % (n + 1); C# Random r = new Random(); r.Next(n + 1);Java Math.floor(Math.random() * (n + 1)); JavaScript Math.floor(Math.random() * (n + </stdlib.h>…

MacPorts command note

Update all packages. $sudo port selfupdate $sudo port sync $sudo port upgrade outdated Uninstall old ports $sudo port uninstall inactive

How to remove "Warning: xcodebuild exists but failed to execute" warning message of MacPorts.

Run the following command. $ sudo xcode-select -switch /Applications/Xcode.app