Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

python,c++,C#Ëæ»úÊýÉú³É

ÏÈ˵python
pythonµÄrandomÄ£¿éÌṩÁ˶à¸öαËæ»úÊý·¢ÉúÆ÷£¬Ä¬È϶¼ÊÇÓõ±Ç°Ê±¼ä´ÁΪËæ»úÊýÖÖ×Ó¡£
ÏÂÃæÊǸÃÄ£¿é¼¸¸ö×î³£Óõĺ¯Êý
random() Return the next random floating point number in the range [0.0, 1.0). 
randint(a,b) Return a random integer N such that a <=
N <= b
randrange([start,]stop[,step]) Return a randomly selected element from range(start,
stop, step).
sample(seq,k) Return k length list of unique elements chosen from the sequence seq(´ÓÐòÁÐÖÐÈ¡³ök¸ö²»Öظ´µÄÖµ£¬ÓÃÆðÀ´·½±ã)
uniform(a,b) Return a random real number N such that a<=N<b
choice(seq) Return a random element from the NONE-empty sequence seq,if seq is empty,raises indexerror
seed([x]) ÉèÖÃËæ»úÊý·¢ÉúÆ÷µÄÖÖ×ÓÖµ£¬Ä¬ÈÏÒÔϵͳʱ¼äΪÖÖ×Ó£¬¾«¶ÈÓ¦¸ÃºÜ¸ß¡£
mark:pythonµÄrandomÄ£¿é»¹ÌṩÁ˸ß˹·Ö²¼£¬ÕýÌ«·Ö²¼£¬beta·Ö²¼µÈµÄËæ»úÊýÉú³É¡£
import random
random.random()
random.randint(0, 1)
random.choice('abcdefghij')
random.uniform(1, 3)
random.sample([1, 2, 3, 4, 5, 6, 7, 8, 9], 5)
ÆäÖУ¬random.randomµÄЧÂÊÒª±Èrandom.int¿ì70±¶¡£
C++µÄËæ»úÊý
rand()ºÍsrand(unsigned int seed)
C++±ê×¼º¯Êý¿âÌṩһËæ»úÊýÉú³ÉÆ÷rand£¬·µ»Ø0£­RAND_MAXÖ®¼ä¾ùÔÈ·Ö²¼µÄαËæ»úÕûÊý¡£ RAND_MAXΪ32767¡£rand()º¯Êý²»½ÓÊܲÎÊý£¬Ä¬ÈÏÒÔ1ΪÖÖ×Ó£¨¼´Æðʼֵ£©¡£ Ëæ»úÊýÉú³ÉÆ÷×ÜÊÇÒÔÏàͬµÄÖÖ×Ó¿ªÊ¼£¬ËùÒÔÐγɵÄαËæ»úÊýÁÐÒ²Ïàͬ£¬Ê§È¥ÁËËæ»úÒâÒå¡££¨µ«ÕâÑù±ãÓÚ³ÌÐòµ÷ÊÔ£© 
C++ÖÐÁíÒ»º¯Êýsrand£¨£©£¬¿ÉÒÔÖ¸¶¨²»Í¬µÄÊý£¨ÎÞ·ûºÅÕûÊý±äÔª£©ÎªÖÖ×Ó¡£µ«ÊÇÈç¹ûÖÖ×ÓÏàͬ£¬Î±Ëæ»úÊýÁÐÒ²Ïàͬ¡£Ò»°ãÊÇÓõ±Ç°Ê±¼ä×÷ΪÖÖ×Ó
ÓÃtime£¨null£©£¬Òª°üº¬time.hÍ·Îļþ
srand((unsigned)time(null))
rand()%MAX
ҪʵÏÖÉÏÃæpythonÆäËû¸÷ÖÖ¹¦ÄÜÖ»ÄÜ×Ô¼ºÊµÏÖÁË¡£
²¢ÇÒÓÉÓÚrandĬÈÏÊÇÒÔ1ΪÖÖ×Ó£¬ËùÒÔÒªÉú³ÉËæ»úÊýʱһ¶¨ÒªÉèÖÃÖÖ×ÓµÄÖµ...
C#µÄËæ»úÊý
RandomÀà
Random ro=new Random() ĬÈÏÒÔµ±Ç°ÏµÍ³Ê±¼ä×÷ΪÖÖ×Ó
ro.Next([a,]b) ·µ»ØÒ»¸ö£¨´óÓÚµÈÓÚa£©Ð¡ÓÚbµÄ·Ç¸ºËæ»úÊý
ro.NextDouble() ·µ»ØÒ»¸ö½éÓÚ0.0ºÍ1.0Ö®¼äµÄËæ»úÊý
ÖµµÃ×¢ÒâµÄÊÇ£¬ÓÉÓÚϵͳʱ¼äµÄ·Ö±æÂÊÓÐÏÞ£¬¶ÔÓÚc++ºÍC#£¬Ê¹ÓÃϵͳʱ¼äÒ²Ö»ÊǾ«È·µ½Ã루pythonµÄ¾«¶ÈºÜ¸ß£©£¬Èç¹ûÁ½´ÎÉèÖÃÖÖ×ÓµÄʱ¼äСÓÚ1Ã룬ÄÇôµÃµ½µÄÐòÁоÍÊÇÒ


Ïà¹ØÎĵµ£º

C: ÃæÏò¶ÔÏó£¨3£©

ÒÔÏ´úÂëÑÝʾÈçºÎÓÃCÀ´Ä£Äâ¶à̬¡£gcc°æ±¾£º3.4.4
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stddef.h>
#ifndef class
        #define class struct
#endif
#ifndef private
        ......

ÓÃC++µ÷ÓÃCµÄ¿âº¯Êý(ת)

 ÓÃC++µ÷ÓÃCµÄ¿âº¯Êý
  C++µ÷ÓÃCµÄ¿âº¯Êýʱ£¬Èç¹ûÍ·Îļþ¶¨ÒåµÃ²»Ç¡µ±£¬¿ÉÄÜ»á³öÏÖÃ÷Ã÷ijº¯ÊýÔÚobjÎļþÖдæÔÚ£¬µ«ÊÇÈ´·¢ÉúÁ´½Óʧ°ÜµÄÇé¿ö£¬³öÏÖÈçÏ´íÎó:
  
  undefined reference to 'xxx'
  ³öÏÖÎÊÌâµÄÔ­ÒòÊÇc¿âº¯Êý±àÒë³ÉobjÎļþʱ¶Ôº¯Êý·ûºÅµÄ´¦ÀíºÍC++²»Í¬¡£ÒòΪC++º¯ÊýÖ§³ÖÖØÔØ£¬Ë ......

C/C++ÓïÑÔvoid¼°voidÖ¸ÕëÉî²ã̽Ë÷

1.¸ÅÊö
¡¡¡¡Ðí¶à³õѧÕ߶ÔC/C++ÓïÑÔÖеÄvoid¼°voidÖ¸ÕëÀàÐͲ»ÉõÀí½â£¬Òò´ËÔÚʹÓÃÉϳöÏÖÁËһЩ´íÎó¡£±¾ÎĽ«¶Ôvoid¹Ø¼ü×ÖµÄÉî¿Ìº¬Òå½øÐнâ˵£¬²¢ÏêÊövoid¼°voidÖ¸ÕëÀàÐ͵ÄʹÓ÷½·¨Óë¼¼ÇÉ¡£
2.voidµÄº¬Òå
¡¡¡¡voidµÄ×ÖÃæÒâ˼ÊÇ“ÎÞÀàÐÍ”£¬void *ÔòΪ“ÎÞÀàÐÍÖ¸Õ딣¬void *¿ÉÒÔÖ¸ÏòÈκÎÀàÐ͵ÄÊý¾Ý¡£
¡ ......

linuxÄÚºËÒÆÖ²s3c2410£¬ÒÆÖ²Õýʽ¿ªÊ¼1

ÔÚÇ°ÃæµÄ×¼±¸¹¤×÷Íê³ÉÖ®ºó£¬ÏÈʵÑéһϣ¬Ì¸²»ÉÏÕæÕýµÄÒÆÖ² £¬ÒòΪ´úÂ붼ûÓиĵġ£
Ê×ÏÈÐ޸Ķ¥²ãµÄMakefile£¬ÐÞ¸ÄARCH,CROSS_COMPLIE±äÁ¿¡£
#ARCH        ?= $(SUBARCH)
ARCH        ?= arm
CROSS_COMPILE    ?= arm-linux-
Ö´ÐÐmake smd ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ