WordNet
- the basic unit of money in South Africa; equal to 100 cents
- Italian novelist and playwright (1867-1936) (同)Luigi Pirandello
- United States writer (born in Russia) noted for her polemical novels and political conservativism (1905-1982) (同)Ayn Rand
PrepTutorEJDIC
- ラント(南アフリカ共和国の通貨の単位)
- memorandumの複数形
- =granddad
- runの過去形
Wikipedia preview
出典(authority):フリー百科事典『ウィキペディア(Wikipedia)』「2015/11/02 19:45:09」(JST)
[Wiki ja表示]
|
「Rand」のその他の用法については「ランド」をご覧ください。 |
randは、引き続く呼び出しが擬似乱数列を返すような関数に付けられる名前である。ランド、ランダムと呼ばれている。以下主に標準Cライブラリのそれについて説明する。
目次
- 1 概要
- 2 初期化
- 3 randの問題点
- 4 形式
- 5 コード例
- 6 参考文献
- 7 外部リンク
概要
(以下、基本的に C99に従う)stdlib.hで宣言されている、0以上かつ定数RAND_MAX以下(数学で使う「以上」「以下」であり両端を含む)の整数値を返す関数である。標準ではマルチスレッドについて触れられておらず、POSIXではスレッドセーフに実装することを要求していない[1]。
また、標準は、randが生成すべき乱数列の品質など、乱数列の乱数性については何も言及していない。
初期化
randの引き続く呼び出しが返す乱数列はsrandで初期化される。srandを呼び出さずにrandを使った場合は、最初に引数を1としてsrandを呼び出した場合と同じように動作しなければならない。一部のBASICでRANDOMIZEという名前であったためランダマイズと呼ばれることもあるが、「種子」を与えているだけで、何かをランダムにしているわけではない。
実行ごとに異なる乱数列を生成するために、簡便な手法としては時刻などが使われる。暗号などの応用では外部から予測が不可能(ないし十分に困難)な方法を使わなければならない。逆に、シミュレーションを再現するためなどでは、同じ数を使用して同じ乱数列を返すようにする。
srandは乱数列に種子を与え初期化するものであるから、randを使用する度にsrandを呼んだりするのは、誤った用法である。
randの問題点
古いrandの実装が生成する乱数列は、問題があるものがほとんどだったことが指摘されている[2]。現代のライブラリでは問題があるものは少なくなっているが、標準の規格書で示された実装例があまり良いものではなかったことや、古いライブラリと同じコードが使われ続けているものもまだあることから、注意を要する。
前述の規格書に示された例をはじめ、randの実装に線形合同法が使われていることがあるので、線形合同法の欠点に注意する必要がある。詳細は線形合同法#短所を参照すること。
ライブラリには標準外でより高品質のrandom、rand48等が用意されていることがある。また、メルセンヌ・ツイスタ等のより良い生成法を検討すべきである。
形式
#include <stdlib.h>
int rand(void);
void srand(unsigned);
コード例
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void)
{
int a;
srand((unsigned int) time(0));
a = (int)((rand() / ((double) RAND_MAX + 1.0)) * 10);
printf("%d", a);
return 0;
}
出力結果(例。0~9のいずれかの値が返る):
8
srandの際に現在時刻を使用しているが、これは実行ごとに異なる乱数列を生成するための、簡便なよく使われる手法である。暗号などの応用では外部から予測が困難な方法を使わなければならない。
特定の範囲で乱数を求めたいときにはa = rand() % 10
とする方法も広く知られているが、線形合同法などの下位ビットの乱数としての品質が低い生成法に備えるため上記のコード例のような上位にあるビットを利用するコードが推奨されている。
参考文献
- ^ http://pubs.opengroup.org/onlinepubs/009695399/functions/rand.html
- ^ Random number generators: good ones are hard to find
外部リンク
rand(3)
– JM Project Linux Library Functions マニュアル
- Boost Random Number Library - 様々な乱数アルゴリズムを使うことが出来るBoostライブラリ
- Boost Random Number Library (cppll) - cppllによる上記の翻訳
C言語 |
|
規格 |
- K&R
- C89
- C99
- C11
- キーワード
- 演算子
- フリースタンディング環境
|
|
標準Cライブラリ |
- 標準Cライブラリ
- BSD libc
- dietlibc
- EGLIBC
- glibc
- musl
- Newlib
- uClibc
|
|
コンパイラ |
- BDS-C
- C++ Builder
- Clang
- gcc
- Intel C++ Compiler
- LSI C-86
- Microsoft Visual C++
- Portable C Compiler
- Turbo C
|
|
派生言語 |
- C++ (C++TR1, C++11, C++14)
- C++ AMP
- C#
- Cg
- Cω
- D言語
- Embedded C++
- Objective-C
- SystemC
- Unified Parallel C
|
|
関連項目 |
|
|
[Wiki en表示]
|
Look up rand in Wiktionary, the free dictionary. |
Rand may refer to:
Contents
- 1 Money and business
- 2 Places
- 3 People
- 4 Organizations
- 5 Science and technology
- 6 See also
Money and business
- South African rand, a currency
- Digital Monetary Trust rand, a digital currency
- Reasonable and non-discriminatory licensing, type of licensing used in the context of standardisation processes
- Rand formula, formula in Canadian labour law
Places
- Rand, New South Wales, small town in Australia
- Rand, Lincolnshire, small village in Lincolnshire, England
- Rand, California, community in Kern County, California
- Rand, Colorado, an unincorporated community in Jackson County, Colorado
- Rand, Texas, an unincorporated community in Kaufman County, Texas
- Rand, West Virginia, a census-designated place in Kanawha County, West Virginia
- Witwatersrand, a ridge that runs through Gauteng, South Africa
People
- Rand (given name)
- Rand (surname)
- Rand Paul, United States Senator from Kentucky
- Jason "Rand" Hitt, software developer
- Rand (Robotech), character from the fictional Third Robotech War
Organizations
- RAND Corporation, an American think tank
- Rand Refinery, the world’s largest gold refinery
Science and technology
- rand, any of a number of pseudorandom number generator functions in various programming languages
- Rand index, technique for measuring the similarity between two data clusters
- R And, a variable star
See also
- East Rand, urban eastern part of the Witwatersrand
- West Rand, urban western part of the Witwatersrand
- Ayn Rand Institute, an American think tank
- Rand McNally, American map publisher and printer
- Ingersoll-Rand, diversified American industrial firm
- Remington Rand, American computer firm and general manufacturer
- Sperry Rand, American equipment and electronics company
- Rand Mining District, area in Kern County, California
- Randburg, area in Gauteng province, South Africa
- Randsburg, California
- Krugerrand, South African gold coin
- Randlord, term used to denote the entrepreneurs who controlled the diamond and gold mining industries in South Africa in its pioneer phase
UpToDate Contents
全文を閲覧するには購読必要です。 To read the full text you will need to subscribe.
English Journal
- Variations in Decision-Making Profiles by Age and Gender: A Cluster-Analytic Approach.
- Delaney R1, Strough J1, Parker AM2, de Bruin WB3.
- Personality and individual differences.Pers Individ Dif.2015 Oct 1;85:19-24.
- Using cluster-analysis, we investigated whether rational, intuitive, spontaneous, dependent, and avoidant styles of decision making (Scott & Bruce, 1995) combined to form distinct decision-making profiles that differed by age and gender. Self-report survey data were collected from 1,075 members
- PMID 26005238
- Abdominal surgery process modeling framework for simulation using spreadsheets.
- Boshkoska BM1, Damij T2, Jelenc F3, Damij N4.
- Computer methods and programs in biomedicine.Comput Methods Programs Biomed.2015 Aug;121(1):1-13. doi: 10.1016/j.cmpb.2015.05.001. Epub 2015 May 16.
- We provide a continuation of the existing Activity Table Modeling methodology with a modular spreadsheets simulation. The simulation model developed is comprised of 28 modeling elements for the abdominal surgery cycle process. The simulation of a two-week patient flow in an abdominal clinic with 75
- PMID 26004999
- Mandated coverage of preventive care and reduction in disparities: evidence from colorectal cancer screening.
- Hamman MK1, Kapinos KA.
- American journal of public health.Am J Public Health.2015 Jul;105 Suppl 3:S508-16. doi: 10.2105/AJPH.2015.302578. Epub 2015 Apr 23.
- OBJECTIVES: We identified correlates of racial/ethnic disparities in colorectal cancer screening and changes in disparities under state-mandated insurance coverage.METHODS: Using Behavioral Risk Factor Surveillance System data, we estimated a Fairlie decomposition in the insured population aged 50 t
- PMID 25905835
Japanese Journal
- Standardization LTE特許プールの設立
- グリーンスパンのアイン・ランド・コネクション(2)中央銀行を嫌う中央銀行家の肖像
- 上嶋祐紀 ,内山彰 ,山口弘純 ,東野輝夫
- 情報処理学会研究報告. ITS, [高度交通システム] 2012-ITS-51(15), 1-8, 2012-11-08
- 本研究では, GPS 信号の特性を用いて通過した建物の出口を特定する手法を提案する.迅速かつ高精度な出口の特定が可能になれば,自律航法の蓄積誤差修正や GPS 測位開始前に現在位置を提示するなど,様々なサービスへの活用が期待される.提案手法では,ユーザが屋内から屋外に移動する際に信号を捕捉した GPS 衛星を時系列順に記録する.この GPS 履歴間に対して,時空間的な特性を考慮した乖離度を定義する …
- NAID 110009486427
Related Links
- I agree with Sebmil (http://php.net/manual/en/function.array-rand.php#105265) that "array_rand()" produces weird and very uneven random distribution (as of my local PHP 5.3.8 and my public host's PHP 5.2.17). Unfortunately, I haven ...
- rand 擬似乱数を返却します 【書式】 #include <stdlib.h> int rand(void); 【説明】 0~RAND_MAX の間の疑似乱数を返します。 乱数とは、要は「でたらめな値」ですが、コンピュータ内ではある規則に従って「でたらめな値」を生成して ...
Related Pictures
★リンクテーブル★
[★]
アメリカオオモミ
- 関
- Abies grandis
[★]
アメリカオオモミ
- 関
- grand fir
[★]
- 同
- PCR-SSCP
- 同
- PCR-SSCP
[★]
トランドラプリル