Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

trandom.c

Go to the documentation of this file.
00001 /*++ 00002 00003 Copyright (c) 1989 Microsoft Corporation 00004 00005 Module Name: 00006 00007 trandom.c 00008 00009 Abstract: 00010 00011 Test program for the random number generator 00012 00013 Author: 00014 00015 Gary Kimura [GaryKi] 26-May-1989 00016 00017 Revision History: 00018 00019 --*/ 00020 00021 #include <stdio.h> 00022 00023 #include <nt.h> 00024 #include <ntrtl.h> 00025 00026 int 00027 _CDECL 00028 main( 00029 int argc, 00030 char *argv[] 00031 ) 00032 { 00033 ULONG Seed; 00034 ULONG Temp; 00035 ULONG i; 00036 CHAR Str[64]; 00037 00038 DbgPrint("Start IntegerToChar and CharToInteger Test\n"); 00039 00040 Seed = 0x12345678; 00041 RtlIntegerToChar(Seed, 2, sizeof(Str), Str); 00042 DbgPrint("Seed = 0b%s\n", Str); 00043 RtlCharToInteger(Str, 2, &Temp); 00044 ASSERTMSG( "RtlCharToInteger(2)", (Seed == Temp) ); 00045 00046 RtlIntegerToChar(Seed, 8, sizeof(Str), Str); 00047 DbgPrint("Seed = 0o%s\n", Str); 00048 RtlCharToInteger(Str, 8, &Temp); 00049 ASSERTMSG( "RtlCharToInteger(8)", (Seed == Temp) ); 00050 00051 RtlIntegerToChar(Seed, 10, sizeof(Str), Str); 00052 DbgPrint("Seed = %s\n", Str); 00053 RtlCharToInteger(Str, 10, &Temp); 00054 ASSERTMSG( "RtlCharToInteger(10)", (Seed == Temp) ); 00055 00056 RtlIntegerToChar(Seed, 16, -8, Str); 00057 Str[ 8 ] = '\0'; 00058 DbgPrint("Seed = 0x%s\n", Str); 00059 RtlCharToInteger(Str, 16, &Temp); 00060 ASSERTMSG( "RtlCharToInteger(16)", (Seed == Temp) ); 00061 00062 DbgPrint("End IntegerToChar and CharToInteger Test\n"); 00063 00064 DbgPrint("Start RandomTest()\n"); 00065 00066 Seed = 0; 00067 for (i=0; i<2048; i++) { 00068 if ((i % 3) == 0) { 00069 DbgPrint("\n"); 00070 } 00071 00072 RtlRandom(&Seed); 00073 DbgPrint("%p ", Seed); 00074 00075 RtlIntegerToChar(Seed, 16, sizeof(Str), Str); 00076 DbgPrint("= %s ", Str); 00077 00078 } 00079 00080 DbgPrint("\n"); 00081 00082 DbgPrint("End RandomTest()\n"); 00083 00084 return TRUE; 00085 00086 }

Generated on Sat May 15 19:42:03 2004 for test by doxygen 1.3.7